Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Pusher error: The data content of this event exceeds the allowed maximum (10240 bytes)

I’m working on a project where I want to live display users’ points whenever the gain or lose points.

I have an api that sends event to the frontend:

    public function test(Request $request){
        $message = $request->message;
        $users = User::all()->where('company_id', $message);
        event(new MyEvent([$users]));
    }

Whenever the api is called, I recieve the following error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Illuminate\Broadcasting\BroadcastException: Pusher error: The data content of this event exceeds the allowed maximum (10240 bytes).

How can this be solved?

>Solution :

The simple answer is to reduce the payload size – Pusher has a size limit on the body of an event – https://pusher.com/docs/channels/library_auth_reference/rest-api/#post-event-trigger-an-event

They also list some strategies for reducing payload size, such as:

  • sending multiple small events instead one one large event (chunking)

  • using compression to reduce payload size

  • sending a link the client that downloads the content instead of transmitting it via Channels.

See https://support.pusher.com/hc/en-us/articles/4412243423761-What-Is-The-Message-Size-Limit-When-Publishing-an-Event-in-Channels- for more info

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading