Skip to content

Commit f813812

Browse files
committed
fix: An issue where events would be sent multiple times
- For some reason using socket.io with this Polyfill would cause socket.io to receive multiple events at a time. Removing the manual call to onopen, onerror, onmessage, etc. fixed the issue.
1 parent 271a5a9 commit f813812

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

deno/WebSocketPolyfill.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,32 +113,20 @@ class WebSocketImpl extends EventTarget {
113113

114114
private _sendOnClose(event: CloseEvent) {
115115
this._readyState = ReadyState.CLOSED;
116-
if (this.onclose) {
117-
this.onclose(event);
118-
}
119116
this.dispatchEvent(event);
120117
}
121118

122119
private _sendOnMessage(event: MessageEvent) {
123-
if (this.onmessage) {
124-
this.onmessage(event);
125-
}
126120
this.dispatchEvent(event);
127121
}
128122

129123
private _sendOnError(event: ErrorEvent) {
130124
this._readyState = ReadyState.CLOSED;
131-
if (this.onerror) {
132-
this.onerror(event);
133-
}
134125
this.dispatchEvent(event);
135126
}
136127

137128
private _sendOnOpen(event: Event) {
138129
this._readyState = ReadyState.OPEN;
139-
if (this.onopen) {
140-
this.onopen(event);
141-
}
142130
this.dispatchEvent(event);
143131
}
144132
}

0 commit comments

Comments
 (0)