Skip to content

Commit 472b210

Browse files
committed
Add missing callback
1 parent dafacbd commit 472b210

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/js/protocols/WebSocket.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,22 @@ class Websocket extends EventTarget {
112112
try {
113113
this.ws.send(data);
114114
this.bytesSent += data.byteLength;
115+
116+
if (cb) {
117+
cb({
118+
error: null,
119+
bytesSent: this.bytesSent,
120+
});
121+
}
115122
} catch (e) {
116123
console.error(`${this.logHead}Failed to send data e: ${e}`);
124+
125+
if (cb) {
126+
cb({
127+
error: e,
128+
bytesSent: 0,
129+
});
130+
}
117131
}
118132
}
119133

0 commit comments

Comments
 (0)