import NodeWebSocket from"ws";export class NodeWebSocketTransport{constructor(e){this._ws=e,this._ws.addEventListener("message",(e=>{this.onmessage&&this.onmessage.call(null,e.data)})),this._ws.addEventListener("close",(()=>{this.onclose&&this.onclose.call(null)})),this._ws.addEventListener("error",(()=>{})),this.onmessage=null,this.onclose=null}static create(e){return new Promise(((s,t)=>{const o=new NodeWebSocket(e,[],{perMessageDeflate:!1,maxPayload:268435456});o.addEventListener("open",(()=>s(new NodeWebSocketTransport(o)))),o.addEventListener("error",t)}))}send(e){this._ws.send(e)}close(){this._ws.close()}}