Closed Bayramito closed 1 year ago
Hi,
I am just trying to make a presence connection to a channel with room_id but sometimes getting this error below.
How to handle connection properly.
My flow looks like this. Im handling these in a MobX store
@action subscribePusherInstance = () => { if (!this.contactId || this.isConnected) { console.log("PUSHER ALREADY CONNECTED OR NO CONTACT ID, EXITING"); return; } // if alredy subscribed, unsubscribe first if (pusher.connectionState === "CONNECTED") { this.unsubscribePusherInstance().catch(console.warn); } pusher .connect() .then(r => { return pusher.subscribe({ channelName: channelName + this.contactId, eventName, onEvent: this.onEvent, onSubscriptionSucceeded: this.onSubscriptionSucceeded, onSubscriptionFailed: this.onSubscriptionFailed, onMemberAdded: this.onMemberAdded, onMemberRemoved: this.onMemberRemoved, onSubscriptionError: this.onSubscriptionError, }); }) .then(r => { if (r.channelName && r.channelName === channelName + this.contactId) { this.isConnected = true; } }) .catch(console.warn); };
and this is the unsubscription part
@action unsubscribePusherInstance = () => { if (!this.contactId) return; return pusher .unsubscribe({channelName: channelName + this.contactId}) .then(r => { this.isConnected = false; // return pusher.disconnect(); }) .catch(console.warn); };
If there is something wrong please let me know...
But this is working most of the time. The error shown in the image is so random... Which make it very weird...
no solution for this ?
This should be fixed on v1.2.2. Could you please test it? @Bayramito
yes sure
Hi,
I am just trying to make a presence connection to a channel with room_id but sometimes getting this error below.
How to handle connection properly.
My flow looks like this. Im handling these in a MobX store
and this is the unsubscription part
If there is something wrong please let me know...
But this is working most of the time. The error shown in the image is so random... Which make it very weird...