From 16d620c46cd76bf09a9b7a33cfb4d9a0f7845dce Mon Sep 17 00:00:00 2001 From: Owen Pearson Date: Wed, 1 Nov 2023 13:23:35 +0000 Subject: [PATCH] fix: don't compare `agent` channel param when determining whether channel options require reattach --- src/common/lib/client/realtimechannel.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/lib/client/realtimechannel.ts b/src/common/lib/client/realtimechannel.ts index 615ab6a686..354be04042 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; } }