-
Notifications
You must be signed in to change notification settings - Fork 55
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
[CAP-49] no connection serials #1110
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 4, 2023 17:54
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 5, 2023 08:36
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 5, 2023 11:33
Inactive
andydunstall
force-pushed
the
feature/CAP-49-no-connection-serials
branch
2 times, most recently
from
January 5, 2023 13:52
13f03fd
to
61552d6
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 5, 2023 13:53
Inactive
andydunstall
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 5, 2023 14:22
61552d6
to
9149e9f
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 5, 2023 14:24
Inactive
andydunstall
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 5, 2023 14:33
9149e9f
to
ad803b5
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 5, 2023 14:34
Inactive
andydunstall
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 6, 2023 08:22
ad803b5
to
5525f43
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 6, 2023 08:24
Inactive
andydunstall
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 6, 2023 09:15
5525f43
to
d18c613
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 6, 2023 09:17
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 6, 2023 12:42
Inactive
andydunstall
changed the title
[WIP] [CAP-49 ] no connection serials
[CAP-49 ] no connection serials
Jan 6, 2023
andydunstall
changed the title
[CAP-49 ] no connection serials
[CAP-49] no connection serials
Jan 6, 2023
SimonWoolf
approved these changes
Jan 16, 2023
SimonWoolf
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 16, 2023 12:47
89d74fe
to
e1c04a9
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1110/typedoc
January 16, 2023 12:49
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 16, 2023 12:50
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1110/bundle-report
January 16, 2023 14:14
Inactive
This is no longer needed in the new upgrade scheme.
With protocol v2 we no longer wait for a `SYNC` so this test doesn't make sense.
…ix race with a 12s ttl, realtime was asking the lib to start a reauth as soon as it connected. With unlucky timings, the original token details could be cleared just before the test code looked at it.
SimonWoolf
force-pushed
the
feature/CAP-49-no-connection-serials
branch
from
January 30, 2023 12:13
e263ea6
to
545ddbf
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements no connection serials as described by https://github.com/ably/specification/pull/88/files, and upgrade described by https://github.com/ably/realtime/issues/4216#issuecomment-1221407649.
Changes
Protocol version
Updates the ably protocol version to
2.0
Spec
1.2
with2.0
Testing
This is already tested by
rest/http.test.js
andrealtime/init.test.js
which check the query string and headers are correct.Resume with
ATTACH
Each channel tracks the latest
channelSerial
its received. Unlike with connection serials we no longer check for duplicates by comparing serials. This was only needed for the old upgrade scheme which could potentially have duplicates. We wanted to keep thechannelSerial
format opaque rather than having to parse it to use for comparison (such as is could be a legacy serial or a time serial).When resuming, instead of including a
connectionSerial
in the query (which leaves the realtime backend to look up the channel serial for each channel and resume), the client just re-attaches the channels including thechannelSerial
in theATTACH
message.This also removes the
checkAttachedMsgIndicators
check, which will re-attach if the channel has not received anATTACHED
after reconnecting, which is now redundant given we always re-attach.Spec
ATTACH
on the new connection for channels in theATTACHING
andSUSPENDED
states - so this just moves channels inATTACHED
states back toATTACHING
when we get a new connection so they re-attachchannelSerial
in theATTACH
messageRealtimeChannel.properties.channelSerial
when receiveMESSAGE
/PRESENCE
/ATTACHED
actions andchannelSerial
is definedRealtimeChannel.properties.channelSerial
when the channel entersDETACHED
/SUSPENDED
/FAILED
statesconnectionSerial
query param on resumeTesting
realtime/resume.test.js
already tests resume works under a number of scenariosPresence Re-Enter
Spec
clientId
only (rather than member key)RealtimePresence.onAttached
is called (though not if already attached as itsRealtimeChannel
already checksstate === this.state
). When attached_ensureMyMembersPresent
runs to perform re-entrymember
id
attribute to the re-entryTesting
presence_auto_reenter
now re-enters both members (even the member that was already in the presence set) andchannel.presence.get
returns the same member (one
) twice with different connection IDsone
wouldn't have been re-entered as it was in the main presence map?)Recovery
The recover now needs to store the
channelSerials
for each attached channel (since this state is no longer kept by the realtime backend), which is encoded as JSON for simplicity rather than some custom format. This adds a new methodcreateRecoveryKey
to create the key rather than recalculating each time (which could get expensive). To keep compatibility also adds arecoveryKey
getter that returnscreateRecoveryKey
, which required updatingtsconfig
to targetes5
(agreed in https://github.com/ably/specification/pull/88/files).Spec
recoverChannels
sets thechannelSerial
for all channels in the recovery key before connectingcreateRecoveryKey
which returns themsgSerial
,connectionKey
andname
tochannelSerial
pairs for each channel, encoded as JSONnull
(ifCLOSED
,CLOSING
,FAILED
, orSUSPENDED
,connectionKey
is clearedrecover multiple channels
which tests the conn id stays the same but the conn key changes after recoverTesting
recover multiple channels
, which is similar toresume_active
except uses recover rather than resume. This also tests the connection id stays the same but the connection key changes as described by RTN16d.Upgrade
Implements the new upgrade scheme as described in option 1 of https://github.com/ably/realtime/issues/4216#issuecomment-1221407649 (not in the spec as ably-js specific). Also rather than keeping the
SYNC
action, which is also used by presence which causes some confusion, upgrade instead now uses theACTIVATE
action to activate the new transport.ACTIVATE
message to the server and assumes the transport is active immediately after sending (since we'll reattach so doesn't matter if we drop messages),ACTIVATE
the server sets the active transport and suspends the connections channels (the same as if it got a resume request),The SDK no longer waits for
channels.onceNopending
since we re-attach once the new connection is activated.Testing
unresponsive_upgrade_sync
test as this no longer makes sense (since we don't wait forSYNC
)Spec