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 13, 2024
1 parent 4323802 commit d5ae78c
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
Expand Up @@ -94,7 +94,7 @@ export class PeerConnection implements EventConnection {

export class WebSocketServer implements EventConnection {
private constructor (
private readonly socket: WebSocket,
private readonly socket: isomorphic.WebSocket,
private readonly eventEmitter: EventEmitter,
private readonly validateReceived?: (msg: any) => boolean,
private readonly validateSent?: (msg: any) => boolean
Expand All @@ -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 isomorphic.WebSocket(url)
ws.binaryType = 'arraybuffer'

const emitter: EventEmitter = new EventEmitter()
Expand Down

0 comments on commit d5ae78c

Please sign in to comment.