aws-mqtt icon indicating copy to clipboard operation
aws-mqtt copied to clipboard

Socket Closing Abruptly

Open TalalBy99 opened this issue 4 years ago • 1 comments

Hello,

I did the basic setup for the frontend as per documentation. I created CognitoIdentityCredentials with an identity pool that allows both unauthenticated users and the unauthenticated users have been given the correct access to use iot in the respective IAM policy. Now, that setup is working fine. The connection is established and the user is able to subscribe and get the response. I wanted to integrate authentication/authorization into this process as my architecture involves multi tenancy (i.e. there are a lot of user/identity pools and I want the current logged in user to only have access to its resources). I know for sure that the policies are setup correctly (as the access that is given to both authenticated and unauthenticated user is the same).

However, my socket keeps on disconnecting when I am trying to do the authenticated connection. I gives me a premature close error. I tried to dig deep into this issue and ran a debugger. The urlSigner is working fine so there shouldn't be any issues on the aws side.

For the authenticated connection, I am adding Logins field to the AWS.CognitoIdentityCredentials constructor which I found in this document

TalalBy99 avatar Jan 18 '21 09:01 TalalBy99

image

Also, in the closeHandler I am getting 1005 event code. Don't know how it is getting triggered

TalalBy99 avatar Jan 18 '21 09:01 TalalBy99