Skip to content

Cannot automatically re-enter channel due to mismatched connectionId #761

@KacperKluka

Description

@KacperKluka

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

  1. Create an AblyRealtime instance.
  2. Create a channel.
  3. Join the presence of the channel.
  4. Turn off the internet connection for 2 minutes.
  5. Turn on the internet connection and wait for the SDK to reconnect (~20-30 seconds)
  6. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working. It's clear that this does need to be fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions