summaryrefslogtreecommitdiff
path: root/op_crates/websocket/lib.rs
diff options
context:
space:
mode:
authorDjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>2021-02-21 22:21:46 +0530
committerGitHub <noreply@github.com>2021-02-21 17:51:46 +0100
commitfe1b512820cbdfd2b93ddfc8e935556878339425 (patch)
tree2d0bac58a55291a8f0275bcbe68ae4a432ca5626 /op_crates/websocket/lib.rs
parenteefd522f0490f9bb829de9342dcd1ed7aeacb42a (diff)
fix(op_crates/websocket): default to close code 1005 (#9339)
Currently if WebSocket is closed without code, it will error while on Chrome it would close with code 1005 instead. Co-authored-by: crowlKats <13135287+crowlKats@users.noreply.github.com>
Diffstat (limited to 'op_crates/websocket/lib.rs')
-rw-r--r--op_crates/websocket/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/op_crates/websocket/lib.rs b/op_crates/websocket/lib.rs
index f43ce8b42..c914f11c5 100644
--- a/op_crates/websocket/lib.rs
+++ b/op_crates/websocket/lib.rs
@@ -322,7 +322,13 @@ pub async fn op_ws_next_event(
"reason": frame.reason.as_ref()
}
}),
- Some(Ok(Message::Close(None))) => json!({ "kind": "close" }),
+ Some(Ok(Message::Close(None))) => json!({
+ "kind": "close",
+ "data": {
+ "code": 1005,
+ "reason": ""
+ }
+ }),
Some(Ok(Message::Ping(_))) => json!({ "kind": "ping" }),
Some(Ok(Message::Pong(_))) => json!({ "kind": "pong" }),
Some(Err(_)) => json!({ "kind": "error" }),