class n{static create(e){return new Promise((s,o)=>{const t=new WebSocket(e);t.addEventListener("open",()=>s(new n(t))),t.addEventListener("error",o)})}#e;onmessage;onclose;constructor(e){this.#e=e,this.#e.addEventListener("message",s=>{this.onmessage&&this.onmessage.call(null,s.data)}),this.#e.addEventListener("close",()=>{this.onclose&&this.onclose.call(null)}),this.#e.addEventListener("error",()=>{})}send(e){this.#e.send(e)}close(){this.#e.close()}}export{n as BrowserWebSocketTransport};
