https://github.com/politie/sseserver
Server to stream a JSON file over Server-Sent-Events (SSE) to a client/browser.
https://github.com/politie/sseserver
consul consul-template server-sent-events
Last synced: 3 months ago
JSON representation
Server to stream a JSON file over Server-Sent-Events (SSE) to a client/browser.
- Host: GitHub
- URL: https://github.com/politie/sseserver
- Owner: politie
- License: apache-2.0
- Created: 2018-04-23T21:44:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-03T08:23:49.000Z (almost 7 years ago)
- Last Synced: 2025-01-19T22:51:39.657Z (4 months ago)
- Topics: consul, consul-template, server-sent-events
- Language: Go
- Size: 23.4 KB
- Stars: 2
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sseserver [](https://travis-ci.org/politie/sseserver) [](https://goreportcard.com/report/github.com/politie/sseserver)
Server to stream a JSON file over [Server-Sent-Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/) to a client/browser.
## Build
Install Go as described: https://golang.org/doc/install and then:
```
make dev-dependencies
make release
```## Test
```
make test
```## Run
```
./sseserver-- -inputFile
```Open `examples/test_sse.html` to receive the SSE events.
### Resend file to all connected clients
```
kill -HUP
```### Use with Consul Template
The `sseserver` works nicely when combined with [Consul Template](https://github.com/hashicorp/consul-template) to stream information from Consul to clients/browsers.
```
./consul-template \
-template=/endpoints.ctmpl:/endpoints.json \
-exec='./sseserver -enable-syslog -context /endpoints -input-file /endpoints.json' \
-exec-reload-signal=SIGHUP
```Contributors
----------* [Arno](https://github.com/arnobroekhof)
* [Richard](https://github.com/rkettelerij)