Purpose of this repository is to understand the usage of Server Side Events using Go.
-
To run the server
go run server/server.go
-
In a different terminal. Run an in-built client
go run client/client.go
Or open the
index.html
file in a browser and click onTrigger Event
button. -
Once the server is up, and you have a client running, send a trigger to
/trigger
endpointcurl -i localhost:8080/trigger
-
The client will show the data that was emitted from server. Any other client can connect on the following url
http://127.0.0.1:8080/events?stream=messages