Skip to content

Commit

Permalink
discojs-core: use isomorphic.WebSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed Feb 8, 2024
1 parent 4bf2d64 commit f7844d4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions discojs/discojs-core/src/client/event_connection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isomorphic from 'isomorphic-ws'
import isomorphic, { WebSocket } from 'isomorphic-ws'
import { EventEmitter } from 'events'
import { Peer } from './decentralized/peer'
import { NodeID } from './types'
Expand Down Expand Up @@ -103,8 +103,7 @@ export class WebSocketServer implements EventConnection {
static async connect (url: URL,
validateReceived?: (msg: any) => boolean,
validateSent?: (msg: any) => boolean): Promise<WebSocketServer> {
const WS = typeof window !== 'undefined' ? window.WebSocket : isomorphic.WebSocket
const ws: WebSocket = new WS(url)
const ws = new WebSocket(url)
ws.binaryType = 'arraybuffer'

const emitter: EventEmitter = new EventEmitter()
Expand Down

0 comments on commit f7844d4

Please sign in to comment.