Skip to content

Latest commit

 

History

History

sse-chat

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

sse-chat

Multi-user realtime chat over Server-Sent Events and the in-process bus provider.

  • The page opens an EventSource to /events, which ranges {{.Bus.Subscribe "messages"}} and streams each message with .Flush.SendSSE.
  • The form POSTs to /messages, which calls {{.Bus.Publish "messages" …}}.
  • Open two browser tabs to see messages fan out to every connected client.
mise run example-sse-chat

Then open http://localhost:9002/

For multi-process messaging (or request/reply, durable streams), swap bus for the nats provider instead.