Skip to content

Commit d08f8f2

Browse files
itsfuaddarrachequesne
authored andcommitted
fix: check if websocket is open before writing (#22)
Related: #23
1 parent 84d97be commit d08f8f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/engine.io/lib/transports/websocket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class WS extends Transport {
1616
public send(packets: Packet[]) {
1717
for (const packet of packets) {
1818
Parser.encodePacket(packet, true, (data: RawData) => {
19-
if (this.writable) {
19+
if (this.writable && this.socket?.readyState === WebSocket.OPEN) {
2020
this.socket?.send(data);
2121
}
2222
});

0 commit comments

Comments
 (0)