From 588f64c760ee49bfb5109bfbaafb4beafe41c52a Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 13 Jul 2020 09:27:08 -0400 Subject: [PATCH] Use status code 1000 on WebSocket hangup for compatibility. --- packages/providers/src.ts/websocket-provider.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/providers/src.ts/websocket-provider.ts b/packages/providers/src.ts/websocket-provider.ts index d0caa9e2c..772884636 100644 --- a/packages/providers/src.ts/websocket-provider.ts +++ b/packages/providers/src.ts/websocket-provider.ts @@ -289,7 +289,8 @@ export class WebSocketProvider extends JsonRpcProvider { })); } - // Hangup (navigating away from the page that opened the connection) - this._websocket.close(1001); + // Hangup + // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes + this._websocket.close(1000); } }