* Add await keyword to multiSocket.ts to await for message to be added to the peer channel.
This commit is contained in:
parent
9791e7c4a1
commit
1882752839
|
@ -189,7 +189,7 @@ export default class MultiSocketProxy extends Proxy {
|
||||||
|
|
||||||
private async _registerOpenSocketMessage(peer: Peer) {
|
private async _registerOpenSocketMessage(peer: Peer) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const message = peer.channel.addMessage({
|
const message = await peer.channel.addMessage({
|
||||||
encoding: {
|
encoding: {
|
||||||
preencode: json.preencode,
|
preencode: json.preencode,
|
||||||
encode: json.encode,
|
encode: json.encode,
|
||||||
|
@ -237,7 +237,7 @@ export default class MultiSocketProxy extends Proxy {
|
||||||
|
|
||||||
private async _registerWriteSocketMessage(peer: Peer) {
|
private async _registerWriteSocketMessage(peer: Peer) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const message = peer.channel.addMessage({
|
const message = await peer.channel.addMessage({
|
||||||
encoding: writeSocketEncoding,
|
encoding: writeSocketEncoding,
|
||||||
onmessage(m: WriteSocketRequest) {
|
onmessage(m: WriteSocketRequest) {
|
||||||
self._sockets.get(m.id)?.push(m.data);
|
self._sockets.get(m.id)?.push(m.data);
|
||||||
|
@ -250,7 +250,7 @@ export default class MultiSocketProxy extends Proxy {
|
||||||
|
|
||||||
private async _registerCloseSocketMessage(peer: Peer) {
|
private async _registerCloseSocketMessage(peer: Peer) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const message = peer.channel.addMessage({
|
const message = await peer.channel.addMessage({
|
||||||
encoding: socketEncoding,
|
encoding: socketEncoding,
|
||||||
onmessage(m: CloseSocketRequest) {
|
onmessage(m: CloseSocketRequest) {
|
||||||
self._sockets.get(m.id)?.end();
|
self._sockets.get(m.id)?.end();
|
||||||
|
@ -263,7 +263,7 @@ export default class MultiSocketProxy extends Proxy {
|
||||||
|
|
||||||
private async _registerTimeoutSocketMessage(peer: Peer) {
|
private async _registerTimeoutSocketMessage(peer: Peer) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const message = peer.channel.addMessage({
|
const message = await peer.channel.addMessage({
|
||||||
encoding: socketEncoding,
|
encoding: socketEncoding,
|
||||||
onmessage(m: SocketRequest) {
|
onmessage(m: SocketRequest) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -277,7 +277,7 @@ export default class MultiSocketProxy extends Proxy {
|
||||||
|
|
||||||
private async _registerErrorSocketMessage(peer: Peer) {
|
private async _registerErrorSocketMessage(peer: Peer) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const message = peer.channel.addMessage({
|
const message = await peer.channel.addMessage({
|
||||||
encoding: errorSocketEncoding,
|
encoding: errorSocketEncoding,
|
||||||
onmessage(m: ErrorSocketRequest) {
|
onmessage(m: ErrorSocketRequest) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue