Questions tagged server-sent-events

Explore the latest questions and answers asked by our top developers.

freeze other function use while(true) in php when need sse

hi I need sse use in my code and it need while(true) run so when I use it other function does not work I need work function in same time while (true) { echo $this->event->fill(); ob_flush(); flush(); if (connection_aborted()) { return; } sleep($interval); } this is my loop function public function index(Request $request) { //do […]

By h h
Published
Categorised as laravel, php, server-sent-events, websocket Tagged , , ,

Server Sent Events (Laravel) not sending my content to client side

I am trying to send updates to client side using SSE, but when I trigger the event in the server side the new data is not send to client side. My client side code: <script> $(document).ready(function($) { var lastMsg = ”; const source = new EventSource("/misc/getData"); source.onmessage = function(event) { console.log(event); var data = JSON.parse(event.data); […]

By jgarcias
Published
Categorised as javascript, laravel, php, server-sent-events Tagged , , ,

What will be the better choice to build chat application? [closed]

I am here to ask for one advice from you. I am at the stage of deciding the technology stack to build a chat application for our online tech product. We don’t want to go with the premium and prebuilt solutions as there are some limitations in each platform as per our requirement with perspective […]

"ob_flush(): failed to flush buffer. No buffer to flush" on production Laravel 8

I am working on Server Sent Event in laravel. I am getting error on production "ob_flush(): failed to flush buffer. No buffer to flush" its working fine on localhost but throwing error on production here is the sse code public function notificationsCount(Request $request) { try { $response = new SymfonyComponentHttpFoundationStreamedResponse(function () use ($request) { while […]

By Ausaf Liaquat
Published
Categorised as laravel, php, server-sent-events Tagged , ,

Laravel’s StreamedResponse not working with javascript’s EventSource

I’m trying to stream my text outputs using StreamedResponse in Laravel, but my javascript is not fetching any messages… To make the code shorter, I simplified my situation to this. First I have some named route: Route::any(‘sync-database’,’[email protected]’)->name(‘sync.database’); Then I have the syncDatabase() method in my controller, which is valid and throws no errors: public static […]

By David Sojka
Published
Categorised as javascript, laravel, php, server-sent-events Tagged , , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq