Server-sent events (SSE) provide a lightweight, long-lived HTTP connection for delivering text-based updates from a server to clients. They fit applications that need real-time, one-way notifications without polling or bidirectional communication. section 7.4.2 section 7.5
Use SSE when the server is the central source of truth:
- Replace periodic polling and successive requests with updates delivered over one persistent connection. section 7.4.2
- Prefer SSE over WebSockets when clients do not need to send messages back to the server. section 7.4.2
- Apply the pattern to notifications, collaboration tools, and other system-generated updates. section 7.4.2
File-change notification website
A Go service watches a directory with fsnotify in a goroutine and sends file changes to a browser through an SSE endpoint. The application reads the directory from SSE_DIRECTORY, exposes /sse and /files, and serves on port 8080; updates can include a file name, operation, and remaining byte length.

