ably / ably-java

Java, Android, Clojure and Scala client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
84 stars 38 forks source link

On connect queued messages are sent before attaching channels #902

Open davyskiba opened 1 year ago

davyskiba commented 1 year ago

When a connection enters the connected state, queued messages are sent first, and channels are attached afterward. This behavior matches the in ConnectionManager.. It can lead to unexpected exceptions i.e. when queued presence leave message is sent before channel reattach like documented in this AAT issue.

sync-by-unito[bot] commented 1 year ago

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3269

paddybyers commented 1 year ago

There should only be queued messages for channels that were attached at the time they were sent.

If it's a reconnection that's a failed resume, then channels should be reattached before queued messages are sent.

ikbalkaya commented 1 year ago

@davyskiba Is it easy to replicate this in AAT repo 🤔 I'd like to test this against some changes I made recently.

ikbalkaya commented 1 year ago

So I had a run with the test locally against ably-java version with changes done https://github.com/ably/ably-java/pull/900 the test passes and it fixes this issue. After confirmed collectively, we should close this issue