summaryrefslogtreecommitdiff
path: root/modules/websocket/emws_peer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket/emws_peer.cpp')
-rw-r--r--modules/websocket/emws_peer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index e0b987b4d7..68f41165eb 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -130,15 +130,17 @@ bool EMWSPeer::is_connected_to_host() const {
return peer_sock != -1;
};
-void EMWSPeer::close() {
+void EMWSPeer::close(int p_code, String p_reason) {
if (peer_sock != -1) {
/* clang-format off */
EM_ASM({
var sock = Module.IDHandler.get($0);
- sock.close();
+ var code = $1;
+ var reason = UTF8ToString($2);
+ sock.close(code, reason);
Module.IDHandler.remove($0);
- }, peer_sock);
+ }, peer_sock, p_code, p_reason.utf8().get_data());
/* clang-format on */
}
peer_sock = -1;