https://github.com/sidkhaliddv/server-sent-events
https://github.com/sidkhaliddv/server-sent-events
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sidkhaliddv/server-sent-events
- Owner: sidkhaliddv
- Created: 2025-01-24T18:33:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-17T18:38:02.000Z (over 1 year ago)
- Last Synced: 2025-06-02T10:24:41.934Z (about 1 year ago)
- Language: JavaScript
- Size: 705 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Server sent events work in a way that server can send the data to the client without client sending the requests, but client first needs to establish a connection.
Criteria:
Its simple, server needs to set a header
Content-Type: text/event-stream
to send events server will do write() instead of send()/json(), each write will be an event to the client
For client:
Clients can establish the connection via
new EventSource(url)
and thats it.
P.S they are lighter than websockets.