13 lines
472 B
Markdown
13 lines
472 B
Markdown
# 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.
|
|
|