Problem
A customer has noticed that after joining a channel's presence and losing the internet connection for 2 minutes when the connection is back the SDK logs an error like this:
io.ably.lib.realtime.Channel: Cannot automatically re-enter <CLIENT_ID> on channel <CHANNEL_NAME> (Malformed message; mismatched connectionId)
The connection ID mismatch shouldn't happen as the RTP17d specifies that the re-enter message should only specify action, data and clientId. However, the SDK seems to include other fields (e.g. id and troublesome connectionId) in the message as seen in one of the log messages:
{
"action": 14,
"channel": "<CHANNEL_NAME>",
"count": 0,
"flags": 0,
"msgSerial": 0,
"presence": [
{
"data": "{}",
"id": "<CONNECTION_ID>:1:0",
"clientId": "<CLIENT_ID>",
"connectionId": "<CONNECTION_ID>",
"action": 2
}
],
"timestamp": 0
}
How to reproduce
- Create an
AblyRealtime instance.
- Create a channel.
- Join the presence of the channel.
- Turn off the internet connection for 2 minutes.
- Turn on the internet connection and wait for the SDK to reconnect (~20-30 seconds)
- You should see the aforementioned error in the logs.
Solution
Only specify the action, data and clientId in the presence part of the re-enter messages when performing the automatic re-entry. The correct version of above message should look like this:
{
"action": 14,
"channel": "<CHANNEL_NAME>",
"count": 0,
"flags": 0,
"msgSerial": 0,
"presence": [
{
"data": "{}",
"clientId": "<CLIENT_ID>",
"action": 2
}
],
"timestamp": 0
}
┆Issue is synchronized with this Jira Bug by Unito
Problem
A customer has noticed that after joining a channel's presence and losing the internet connection for 2 minutes when the connection is back the SDK logs an error like this:
The connection ID mismatch shouldn't happen as the RTP17d specifies that the re-enter message should only specify
action,dataandclientId. However, the SDK seems to include other fields (e.g.idand troublesomeconnectionId)in the message as seen in one of the log messages:{ "action": 14, "channel": "<CHANNEL_NAME>", "count": 0, "flags": 0, "msgSerial": 0, "presence": [ { "data": "{}", "id": "<CONNECTION_ID>:1:0", "clientId": "<CLIENT_ID>", "connectionId": "<CONNECTION_ID>", "action": 2 } ], "timestamp": 0 }How to reproduce
AblyRealtimeinstance.Solution
Only specify the
action,dataandclientIdin thepresencepart of the re-enter messages when performing the automatic re-entry. The correct version of above message should look like this:{ "action": 14, "channel": "<CHANNEL_NAME>", "count": 0, "flags": 0, "msgSerial": 0, "presence": [ { "data": "{}", "clientId": "<CLIENT_ID>", "action": 2 } ], "timestamp": 0 }┆Issue is synchronized with this Jira Bug by Unito