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 Antwort
1
Akzeptierte Antwort

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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen