FayeSwift
FayeSwift copied to clipboard
Single server messages should be serialized as JSON arrays
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.
@vrutberg just say this... thanks for bringing this up. Are you able to submit a PR?
yes, I'll give it a shot!