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개 답변
1
수락된 답변

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
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠