These three bugs were cancelling each other, so it's impossible to address them in different PRs since to fix all the tests failures you need to fix other two bugs. Please see commit messages and review per commit basis.
What happens here is that in addition to re-attach we need re-detach as well to continue the process after connection becomes CONNECTED. But in oppose to attach there were no internal method for doing so, that's why I've splitted _detach into internalDetach: which doesn't do state check before proceeding with detaching. Also because detach message shouldn't be queued I've removed shouldQueueEvents check from the detachAfterChecks.
305d8db3 "Sending queued messages should be after reattach":
If you send message before sending ATTACH, realtime won't respond and tests will timeout. You can check it with test__065__Channel__publish__Message_connectionId_should_match_the_current_Connection_id_for_all_published_messages test.
16b38064 "Only queue publish and presence messages":
The check else if (msg.ackRequired) you should read as "if message can be queued", since ACK required with the same condition as queuing - message is either MESSAGE or PRESENCE. Also I've added log line if message sending was ignored.
Closes #1936, #1938 and #1940
These three bugs were cancelling each other, so it's impossible to address them in different PRs since to fix all the tests failures you need to fix other two bugs. Please see commit messages and review per commit basis.
See also https://github.com/ably/specification/pull/194
Some additional info for commits messages.
d60269af "Proceeding with detach on
CONNECTED
":What happens here is that in addition to re-attach we need re-detach as well to continue the process after connection becomes
CONNECTED
. But in oppose toattach
there were no internal method for doing so, that's why I've splitted_detach
intointernalDetach:
which doesn't do state check before proceeding with detaching. Also because detach message shouldn't be queued I've removedshouldQueueEvents
check from thedetachAfterChecks
.305d8db3 "Sending queued messages should be after reattach":
If you send message before sending
ATTACH
, realtime won't respond and tests will timeout. You can check it withtest__065__Channel__publish__Message_connectionId_should_match_the_current_Connection_id_for_all_published_messages
test.16b38064 "Only queue publish and presence messages":
The check
else if (msg.ackRequired)
you should read as "if message can be queued", sinceACK
required with the same condition as queuing - message is eitherMESSAGE
orPRESENCE
. Also I've added log line if message sending was ignored.