What is the message size limit when publishing a message in Channels?

The message size limit is 10KB. The size of the message is calculated based on the number of bytes in the HTTP POST body. For more information see the Server Publishing docs.

Why is a message size limit imposed?

The processing required to handle large messages can degrade the quality of service experienced by other Pusher Channels customers so we have imposed a message size limit. Our focus is to enable distribution of small messages as fast as possible so to ensure that we can quickly parse and distribute messages we have imposed the 10KB message limit.

How can I send larger messages?

There are several approaches to work around this limit:

  1. Chunking. One approach is to split your large message into smaller chunks before publishing, then recombine them on receipt. This repository shows an example of a chunking protocol: https://github.com/pusher/pusher-channels-chunking-example.
  2. Linking. Instead of sending a large message via Pusher Channels, you could store that message elsewhere, and just your clients send a link to that content.
  3. Compression, e.g.
    1. Compression algorithms like gzip.
    2. Removing unnecessary characters. Whitespace is one example.
    3. Removing/shortening keys. Instead of {"user":"jim","email":"jim@example.com"}, you could use {"u":"jim","e":"jim@example.com"}, or ["jim","jim@example.com"].
  4. A dedicated cluster. If none of the above are suitable and you really need to sender larger single messages, we can set up a dedicated cluster. If you are interested in provisioning a dedicated cluster as part of an enterprise package please contact Pusher sales.

 

Was this article helpful?
1 out of 1 found this helpful
Haven't found what you were looking for?
Submit a ticket