From d2575a1ec3526e50268001d9541c7f6416475e20 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Wed, 9 Oct 2024 22:32:39 -0400 Subject: [PATCH] fix WebSocket check that is no longer exactly the right thing --- app/client/components/GristClientSocket.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/client/components/GristClientSocket.ts b/app/client/components/GristClientSocket.ts index ed2d2d6f..f3b69bf4 100644 --- a/app/client/components/GristClientSocket.ts +++ b/app/client/components/GristClientSocket.ts @@ -71,7 +71,12 @@ export class GristClientSocket { } private _createWSSocket() { - if (typeof WebSocket !== 'undefined') { + // We used to check if WebSocket was defined here, and use it + // if so, secure in the fact that we were in the browser and + // the browser would pass along cookie information. But recent + // node defines WebSocket, so we narrow down this path to when + // window is defined. + if (typeof window !== 'undefined') { this._wsSocket = new WebSocket(this._url); } else { this._wsSocket = new WS(this._url, undefined, this._options);