Skip to content

Unique identifier mechanic is broken #43

@allaire

Description

@allaire

The last commit that adds the UID mechanic is not working correctly, since it's always relying on the first element of the identifier dictionary. The issue happens when the order is different in the JSONSerializer.deserialize method. We had a regression in iOS 10 because the order of the JSON is different than iOS 11. See below:

iOS 11

{"identifier":"{\"member_id\":\"20c5edcc-5dda-4f43-a0df-b86a908001b6\",\"channel\":\"ConversationsChannel\"}","type":"confirm_subscription"}

iOS 10

{"identifier":"{\"channel\":\"ConversationsChannel\",\"member_id\":\"20c5edcc-5dda-4f43-a0df-b86a908001b6\"}","type":"confirm_subscription"}

This cause a problem because the channel's key in unconfirmedChannels in this example is the member's uuid (since it's always the first element of the identifier dictionary in the create method, but the message.uid is ConversationsChannel under iOS 10 because that's the first element of the onText text JSON.

A quick fix would be to remove the channel key, but I think the solution is not really elegant to be honest. We could also create a unique hash using a similar technique like this one:
https://github.com/rails/rails/blob/master/actioncable/app/assets/javascripts/action_cable/subscription.coffee#L54

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions