-
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
[WIP] [CAP-49] no connection serials #1045
Conversation
23de044
to
49e1f50
Compare
49e1f50
to
ba44b8c
Compare
ba44b8c
to
20eaa12
Compare
45b1b73
to
b5b51c1
Compare
a8fa21a
to
5ae8539
Compare
test/realtime/resume.test.js
Outdated
} catch (err) { | ||
cb(err); | ||
} | ||
}, 2000); |
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.
Tests will become flaky because of the timeout, we can use waitforexpect instead. It will skip extra timeout ( supplied as a default moderate value, to make sure non-flaky tests) as soon as the expectation is matched against the given assertion and execute the promise callback.
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.
waitForExpect(() => {
expect(recoveredCount).to.equal(MSG_COUNT);
}).then(cb);
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.
We are using it in the ably-echo
library -> https://github.com/ably-forks/echo/blob/afdf9c63ea81f2a8f54811d1a3e926577ea7dd2f/tests/ably/ably-channel.test.ts#L177
We no longer wait for a response from the server on upgrade, so this test is redundant.
We no longer wait for a SYNC response so the transport was being upgraded before the channel was attached. Instead publish immediately without waiting to attach so the message is queued while the comet transport is still active.
With 2.0 connectionKey is only include in connectionDetails
With upgrade we don't wait for a response, so the first attach request is ignored (as the ACTIVATE immediately suspends the channel), so the subscriber misses the publish.
81152fa
to
7793077
Compare
Given this PR is now old and the commit history quite messy I've replaced with #1110 |
Add support for no connection serials as described in ably/specification#88.
(Note I've updated the original PR to try to make it clearer which commits implement which spec items - so should be easier to walk though commit by commit if thats useful when implementing the other SDKs - and I've moved the ably-js specific upgrade stuff into the last two commits so those can be ignored)
Changes
2.0
(RSC7a)initbase0
message.channelSerial
is a string not a number (eg'e02Tut8QwBFsQM05921682:5'
)channelSerial
opaque rather than having to parse it to compareresume_active
channelSerial
inATTACH
(RTL4c1)resume_active
connectionSerial
from resume request (RTN15b2)resume_active
attached
channels once connected (RTN15c6/RTN15c7)attaching
andsuspended
states aleady go though the attach sequence on connected (RTN15c6/RTN15c7)attached
channels inConnectionManager
as this is now always done when we get a new connection, regardless of whether the connection id changed (RTN15c3)msgSerial
is already reset anderrorReason
is already set (RTN15c7)channelSerial
when detached/suspended/failed (RTP5a1)rewind works on channel after reattaching
test (if we don't clear the rewind will fail)connectionKey
isundefined
connect
, since therecover
param may be a user defined callback it can't be loaded in the constructor, and by the time we get toconnect
we know theres no attached channels butrecover
has been resolved into a string (bygetTransportParams
)data
andchannelId
already sent) (RTP17g)ATTACHED
(RTP17f) (regardless of ifHAS_PRESENCE
has been set (RTP17c2))connectionId
, regardless of whether its in the main presence map, and no longer removes from the 'my members' presence map (RTP17g/RTP17d)presence_auth_reenter
duplicateConnectionId
test as now redundantcheckChannelsOnResume
optionschannelSerial
if empty (RTP17h)Upgrade Changes
(ably-js only - from https://github.com/ably/realtime/issues/4216#issuecomment-1221407649)
SYNC
withACTIVATE
mostRecentMessage
as this is no longer needed in the new upgrade scheme (and causes a bug - see thread)duplicateMsgId
test as now redundant