diff --git a/src/base/types.ts b/src/base/types.ts index 853c45f..472473b 100644 --- a/src/base/types.ts +++ b/src/base/types.ts @@ -153,6 +153,8 @@ interface CustomWebSocket { } export interface WSOptions extends BaseOptions, AuthOptions, ConnectionOptions { + headers?: { [key: string]: string } | undefined + ssl?: boolean platform?: 'web' | string protover?: 1 | 2 | 3 diff --git a/src/node.ts b/src/node.ts index e3a586e..dde08c4 100644 --- a/src/node.ts +++ b/src/node.ts @@ -276,7 +276,9 @@ export class KeepLiveWS = object> extends LiveCl } } else { - socket = new WebSocket(_url) + socket = new WebSocket(_url, { + headers: options.headers, + }) socket.binaryType = 'arraybuffer' } if (socket) { @@ -304,7 +306,9 @@ export class KeepLiveWS = object> extends LiveCl } } else { - socket = new WebSocket(url) + socket = new WebSocket(url, { + headers: options.headers, + }) socket.binaryType = 'arraybuffer' }