The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

How to implement Server Sent Events (SSE) with Slim 3

Kyle K's Avatar

Kyle K

06 Jan, 2016 10:55 AM

Server Sent Events allow for a client HTTP connection to receive multiple responses from the server. It basically keeps the connection open and waits for responses.

The PHP examples I've seen online depict a script that is in an infinite loop, checking for updates and if there are then they send a http response back and continue on with the script.
http://www.howopensource.com/2014/12/introduction-to-server-sent-events/

I tried implementing this in Slim v2 and I couldn't keep the app running after sending an http response back. How would I implement this in Slim v3?

Thanks

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac