diff --git a/src/common/lib/client/realtimechannel.ts b/src/common/lib/client/realtimechannel.ts index 615ab6a686..fd29a487e3 100644 --- a/src/common/lib/client/realtimechannel.ts +++ b/src/common/lib/client/realtimechannel.ts @@ -189,7 +189,14 @@ class RealtimeChannel extends Channel { return false; } if (options?.params) { - if (!this.params || !Utils.shallowEquals(this.params, options.params)) { + // Don't check against the `agent` param - it isn't returned in the ATTACHED message + const requestedParams = Object.assign({}, options.params); + delete requestedParams.agent; + if (Object.keys(requestedParams).length !== 0 && !this.params) { + return true; + } + + if (this.params && !Utils.shallowEquals(this.params, requestedParams)) { return true; } } @@ -630,6 +637,7 @@ class RealtimeChannel extends Channel { case actions.ATTACHED: { this.properties.attachSerial = message.channelSerial; this._mode = message.getMode(); + console.log('Channel.onMessage ATTACHED, setting params to:', (message as any).params); this.params = (message as any).params || {}; const modesFromFlags = message.decodeModesFromFlags(); this.modes = (modesFromFlags && Utils.allToLowerCase(modesFromFlags)) || undefined;