Amplify PubSub AWSIoTProvider in multiple browser tabs

0

We have a web browser application (angular) using Amplify PubSub with Cognito authentication. Everything is working correctly in a single window: connect, publish, subscribe all working.

However, if one of our users opens a second browser tab/window for the application, the original window disconnects with the error:

MqttOverWSProvider errorCode:8 AMQJS0008I Socket closed

In our application it is quite common for it to be open in more than one tab/window at the same time.

Is there a setting or something we need to do in order to prevent disconnection in the first open tab?

1 Resposta
1
Resposta aceita

The description of the behavior suggests you have a client ID conflict. Only one active connection can use a distinct client ID. If a second connection succeeds and uses the same client ID as another connection, the service behavior is to disconnect the existing session. Does your application pass a value to the PubSub provider? It looks like if no client ID is explicitly defined, the provider will create a new UUID. https://github.com/aws-amplify/amplify-js/blob/a047ce73/packages/pubsub/src/Providers/MqttOverWSProvider.ts#L38

AWS
Ryan_B
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas