diff --git a/src/treaty2/index.ts b/src/treaty2/index.ts index fb4a599..6d542bb 100644 --- a/src/treaty2/index.ts +++ b/src/treaty2/index.ts @@ -223,7 +223,7 @@ const createProxy = ( path + q - return new EdenWS(url) + return new EdenWS(url, headers['Sec-WebSocket-Protocol']) } return (async () => { diff --git a/src/treaty2/ws.ts b/src/treaty2/ws.ts index 75da87a..b2bbbea 100644 --- a/src/treaty2/ws.ts +++ b/src/treaty2/ws.ts @@ -5,8 +5,8 @@ import { parseMessageEvent } from '../utils/parsingUtils' export class EdenWS = {}> { ws: WebSocket - constructor(public url: string) { - this.ws = new WebSocket(url) + constructor(public url: string, protocols?: string | string[]) { + this.ws = new WebSocket(url, protocols) } send(data: Schema['body'] | Schema['body'][]) {