Files
react-sse/README.md

13 lines
472 B
Markdown
Raw Normal View History

2026-03-01 01:11:48 +01:00
# React Server-Sent Events
This is a library to send SSE events to a browser using ReactPHP.
## Usage
1. When receiving a request, create a new `NoccyLabs\React\Sse\EventSource` object.
2. Return the `ResponseInterface` object from `$es->response()` to the client.
3. Send your events using `$es->sendMessage()` and `$es->sendEvent()`.
4. Use `$es->close()` to terminate the connection.
5. Listen for the `close` event to know when it it time to discard the instance.