diff --git a/src/wire/Socket.ts b/src/wire/Socket.ts index ed5fca0..23c905b 100644 --- a/src/wire/Socket.ts +++ b/src/wire/Socket.ts @@ -202,9 +202,14 @@ export class InteractiveSocket extends EventEmitter { if (this.options.authToken) { extras.headers['Authorization'] = `Bearer ${this.options.authToken}`; } - url.query = Object.assign({}, url.query, this.options.queryParams); - this.socket = new InteractiveSocket.WebSocket(Url.format(url), [], extras); + if (typeof WebSocket === 'function' && WebSocket === InteractiveSocket.WebSocket) { + url.query = Object.assign({}, url.query, this.options.queryParams, extras.headers); + this.socket = new InteractiveSocket.WebSocket(Url.format(url)); + } else { + url.query = Object.assign({}, url.query, this.options.queryParams); + this.socket = new InteractiveSocket.WebSocket(Url.format(url), [], extras); + } this.state = SocketState.Connecting;