From fd8588aa1da378a9d9b2ea5c2f618267cc2fb7b2 Mon Sep 17 00:00:00 2001 From: Jan Thurau Date: Sun, 24 Mar 2024 12:17:02 +0100 Subject: [PATCH] websocket: enable following redirects (#806) --- packages/provider/src/HocuspocusProviderWebsocket.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/provider/src/HocuspocusProviderWebsocket.ts b/packages/provider/src/HocuspocusProviderWebsocket.ts index b0a957b7..1b8482a7 100644 --- a/packages/provider/src/HocuspocusProviderWebsocket.ts +++ b/packages/provider/src/HocuspocusProviderWebsocket.ts @@ -4,8 +4,7 @@ import { import { retry } from '@lifeomic/attempt' import * as time from 'lib0/time' import * as url from 'lib0/url' -import type { MessageEvent } from 'ws' -import { Event } from 'ws' +import { type MessageEvent, Event } from 'ws' import EventEmitter from './EventEmitter.js' import { HocuspocusProvider } from './HocuspocusProvider.js' import { @@ -349,7 +348,7 @@ export class HocuspocusProviderWebsocket extends EventEmitter { this.identifier += 1 // Init the WebSocket connection - const ws = new this.configuration.WebSocketPolyfill(this.url) + const ws = new this.configuration.WebSocketPolyfill(this.url, { followRedirects: true }) ws.binaryType = 'arraybuffer' ws.identifier = this.identifier