Skip to content

Single server messages should be serialized as JSON arrays #24

@vrutberg

Description

@vrutberg

Currently, FayeSwift serializes a single JSON message sent to the server as a JSON object. As stated in the Bayeux protocol specification, clients should send even single server messages as an array of messages, but server implementations are only required to accept an array of messages. Therefore, sending single messages as arrays practically guarantees compatibility with any server implementation.

All Bayeux messages SHOULD be encapsulated in a JSON encoded array so that multiple messages may be transported together. A Bayeux client or server MUST accept either array of messages and MAY accept a single message.

https://docs.cometd.org/current/reference/#_messages

I encountered this while trying to implement FayeSwift in an app that communicates with a Java CometD server, which only accepts arrays of messages.

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