Skip to content

Server and client examples of using Server Side Events to update UIs in real time

Notifications You must be signed in to change notification settings

lucasbflopes/server-side-events-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Server Side Events

Server side events is a unidirectionally way to stream notifications/events to clients. It sits on top of TCP/IP and works by keeping a long running connection between client and server through which the server is able to stream event data.

Run server

To start the server run:

go run server/main.go

Run clients

Web

Open the file client/index.html on your browser.

Others

One can subscribe to the server through http as follows:

curl -X GET http://localhost:8080/sse/subscribe

Dispatch events

To send events to all clients subscribed to the same server, run:

curl -X POST http://localhost:8080/sse/dispatch?data=${event-content}

References

About

Server and client examples of using Server Side Events to update UIs in real time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published