What Is The Message Size Limit When Publishing an Event in Channels?

The message size limit is 10KB. The size of the message is calculated based on the number of bytes in the data content within 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 send 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":"ben","email":"ben@example.com"}, you could use {"u":"ben","e":"ben@example.com"}, or ["ben","ben@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.

Still have questions? Please reach out to our Support team by visiting this page.

Last updated