mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Websocket peer outbound buffer fixes. Expose outbound buffered amount.
This commit is contained in:
parent
44012fa61d
commit
de02cf44ae
10 changed files with 56 additions and 4 deletions
|
@ -101,6 +101,15 @@ const GodotWebSocket = {
|
|||
return 0;
|
||||
},
|
||||
|
||||
// Get current bufferedAmount
|
||||
bufferedAmount: function (p_id) {
|
||||
const ref = IDHandler.get(p_id);
|
||||
if (!ref) {
|
||||
return 0; // Godot object is gone.
|
||||
}
|
||||
return ref.bufferedAmount;
|
||||
},
|
||||
|
||||
create: function (socket, p_on_open, p_on_message, p_on_error, p_on_close) {
|
||||
const id = IDHandler.add(socket);
|
||||
socket.onopen = GodotWebSocket._onopen.bind(null, id, p_on_open);
|
||||
|
@ -171,6 +180,11 @@ const GodotWebSocket = {
|
|||
return GodotWebSocket.send(p_id, out);
|
||||
},
|
||||
|
||||
godot_js_websocket_buffered_amount__sig: 'ii',
|
||||
godot_js_websocket_buffered_amount: function (p_id) {
|
||||
return GodotWebSocket.bufferedAmount(p_id);
|
||||
},
|
||||
|
||||
godot_js_websocket_close__sig: 'viii',
|
||||
godot_js_websocket_close: function (p_id, p_code, p_reason) {
|
||||
const code = p_code;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue