-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MessagingSession reconnects with refreshed endpoint and credentials if needed #2400
Conversation
@@ -47,13 +47,17 @@ export default class MessagingSessionConfiguration { | |||
/** | |||
* Constructs a MessagingSessionConfiguration optionally with userArn, messaging session id, a messaging session | |||
* endpoint URL, and the chimeClient. | |||
* | |||
* endpointUrl is deprecated and should not be used. Internally it is resolved on connect via chimeClient if undefined, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would suggest mark it deprecated with @deprecated
https://code.visualstudio.com/updates/v1_49#_deprecated-tag-support-for-javascript-and-typescript
const closeEvent = new CloseEvent('close', { | ||
wasClean: false, | ||
code: 4999, | ||
reason: 'Failed to getMessagingSessionEndpoint', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since getMessagingSessionEndpoint
is an function on AWS SDK v2, this would be irrelevant to AWS SDK v3. So should we change it to just 'Failed to get messaging session endpoint URL'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx will update
@@ -105,7 +107,32 @@ export default class DefaultMessagingSession implements MessagingSession { | |||
} | |||
|
|||
private async startConnecting(reconnecting: boolean): Promise<void> { | |||
const signedUrl = await this.prepareWebSocketUrl(); | |||
// reconnect needs to re-resolve endpoint url, which will also refresh credentials on client if they are expired | |||
let endpointUrl = !reconnecting ? this.configuration.endpointUrl : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is this better to read?
let endpointUrl = this.configuration.endpointUrl;
// reconnect needs to re-resolve endpoint url, which will also refresh credentials on client if they are expired
if (reconnecting || endpointUrl === undefined) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, think so. Will update thx
Can we verify with both v2 and v3 (different importing) to make sure it works ? |
Done, and updated directions on pr on how to do |
done(); | ||
}, | ||
}); | ||
messagingSession.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With v3, you have to use await
as the messagingSession.start
returns a promise now:
https://github.com/aws/amazon-chime-sdk-js/blob/main/guides/17_Migration_to_3_0.md#remove-aws-global-object-from-messagingsessionconfigurationts
Also could you please update the migration doc for the same and make the endpointUrl
undefined
there as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could you please update the migration doc for the same and make the endpointUrl undefined there as well?
Done
Issue #:
Fixs 4401 from #2372
Description of changes:
MessagingSession reconnects with refreshed endpoint and credentials if needed. This is an updated version of #2180 that was reverted
Testing:
Tested with demo app (see below)
Can these tested using a demo application? Please provide reproducible step-by-step instructions.
npm run start --app=messagingSession
Then test again with the following diff to see working on v2 version of client:
During the testing suggest looking at networking console to see disconnect, retries, and retry success when wifi comes back up
Checklist:
npm run build:release
locally?yes
yes these have been reviewed
no
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.