From 4d75c11299975371e026ebe16499c1ec815505c5 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 25 Feb 2023 22:11:22 -0500 Subject: [PATCH] *event message must pass a MessageEvent --- src/socket.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/socket.ts b/src/socket.ts index ead2f42..5f21b0b 100644 --- a/src/socket.ts +++ b/src/socket.ts @@ -57,8 +57,10 @@ export default class Socket extends Duplex { } if (this._emulateWebsocket) { - // @ts-ignore - this.addEventListener("data", (data: any) => this.emit("message", data)); + this.addEventListener("data", (data: any) => + // @ts-ignore + this.emit("message", new MessageEvent("data", { data })) + ); } }