From 92245a6c1c7c546d79af54af131cad156d3d982a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 8 Apr 2023 20:56:26 -0400 Subject: [PATCH] *As a kernel-based protomux may be used, need to await on createChannel and addMessage --- src/peer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/peer.ts b/src/peer.ts index d6cd495..b82c807 100644 --- a/src/peer.ts +++ b/src/peer.ts @@ -115,7 +115,7 @@ export default class Peer { emulateWebsocket: self._emulateWebsocket, }); - this._channel = this._muxer.createChannel({ + this._channel = await this._muxer.createChannel({ protocol: this._proxy.protocol, async onopen(m: any) { if (!m) { @@ -142,7 +142,7 @@ export default class Peer { }); if (this._createDefaultMessage) { - pipe = this._channel.addMessage({ + pipe = await this._channel.addMessage({ async onmessage(m: any) { if (m instanceof Uint8Array) { m = Buffer.from(m);