https://github.com/75lb/sse-server
Push an event stream from terminal to browser
https://github.com/75lb/sse-server
Last synced: about 1 year ago
JSON representation
Push an event stream from terminal to browser
- Host: GitHub
- URL: https://github.com/75lb/sse-server
- Owner: 75lb
- License: mit
- Created: 2018-12-15T20:26:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-03T13:49:08.000Z (almost 3 years ago)
- Last Synced: 2025-04-19T23:04:15.646Z (over 1 year ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.org/package/sse-server)
[](https://www.npmjs.org/package/sse-server)
[](https://github.com/75lb/sse-server/network/dependents?dependent_type=REPOSITORY)
[](https://github.com/75lb/sse-server/network/dependents?dependent_type=PACKAGE)
[](https://github.com/75lb/sse-server/actions/workflows/node.js.yml)
[](https://github.com/feross/standard)
# sse-server
Pipe an event stream from terminal to browser.
## Synopsis
Launch the server.
```
$ sse-server
SSE server: http://localhost:9000
Input socket: localhost:9090
```
Pipe events to the input socket.
```
$ echo '{ "name": "something", "data": "one" }' | nc -c localhost 9090
$ echo '{ "name": "something", "data": "two" }' | nc -c localhost 9090
```
Connect a browser to the SSE server to consume the [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).
```
$ curl http://localhost:9000
event: something
data: "one"
event: something
data: "two"
```
* * *
© 2018-22 Lloyd Brookes \<75pound@gmail.com\>.