Hello, i got this when doing logout/changing userId deps
WebSocket connection to 'wss://sse.sg.amity.co/mqtt' failed: Close received after close
here’s the relevant code
const SDKInfo = useMemo(() => {
if (!client) {
client = new ASCClient({ apiKey, apiEndpoint, apiRegion });
client.on('connectionStatusChanged', (data) => {
onConnectionStatusChange && onConnectionStatusChange(data);
if (data.newValue === ConnectionStatus.Connected) {
onConnected && onConnected();
} else if (data.newValue === ConnectionStatus.Disconnected) {
onDisconnected && onDisconnected();
}
});
} else if (client.currentUserId !== userId) {
client.unregisterSession()
}
// boolean will block looping reconnection
if (!client.currentUserId) {
client.registerSession({
userId,
displayName,
authToken,
});
}
return { client };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [apiKey, userId, displayName, authToken, preventReconnect]);
package version: “@amityco/js-sdk”: “^5.37.4”