-
Notifications
You must be signed in to change notification settings - Fork 216
prepareConnection to better support Cloud routing and region-pinning #783
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
Conversation
🦋 Changeset detectedLatest commit: 49a862b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
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.
lg!
src/room/Room.ts
Outdated
// trigger the first fetch without waiting for a response | ||
// if initial connection fails, this will speed up picking regional url | ||
// on subsequent runs | ||
this.regionUrlProvider.fetchRegionSettings().catch((e) => { |
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.
I think this line can go after the else
clause so that it runs even if regionUrlProvider
has been set by a previous prepareConnection
call already?
also on disconnect
we currently don't clear the regionUrlProvider. so with the sequence connect -> disconnect -> connect we would skip fetching region settings the second time around currently.
would probably make sense to at least resetAttempts
of the url provider on disconnect/engine closing.
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 makes sense. it should clear out all the previous urls + providers as the primary url may have changed. I'll make that change
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.
looks good, just some minor comments.
When using Cloud, establish connection to fetch region URL so we have better control of routing decisions.
For projects with region-pinning enabled,
/settings/regions
would only return regions that are allowed. if prepareConnections is not used, Cloud would reject the initial connection if DNS-based routing ends up connecting to a disallowed region.