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 })) + ); } }