MQTT error

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”

1 Like

Hello @kanon , For further investigation, we kindly request the following information:

  1. API Key
  2. Server Region

Additionally, if you have Secure Mode enabled, please disable it or provide us with the Server Key.
Please send the requested information to our support email: support.asc@amity.co.