Which is the messages format in channels?

87 Views Asked by At

When the backend server publishes data to pushpin reverse-proxy channels which is the format of messages in the channels?

1

There are 1 best solutions below

0
jkarneges On

The format of data within channels are transport-dependent.

  • For http-stream, the content is a byte array.
  • For http-response, the content is a status code, list of headers, and body data (as a byte array).
  • For ws-message, the content is a message type (default TEXT) and either UTF-8 string (for the TEXT type) or byte array (for BINARY or other types).

Within those rules, any remaining format decisions are up to you. For example, if you want to publish a WebSocket TEXT message containing JSON data, it is your job to JSON-encode the data and provide that as the content for a TEXT message. Pushpin only cares that the content is valid UTF-8.