Server-Sent Events
Receive messages as a Server-Sent Events stream, for scripts and command-line tools.
On this page
Server-Sent Events is a one-way stream: the client only receives. Use it when your tool cannot speak WebSocket.
Connect
Send GET / with the header Accept: text/event-stream and your token, in the token query argument or the x-token header:
curl -N -H "Accept: text/event-stream" -H "x-token: YOUR_TOKEN" "https://sync.example.com/"The stream starts with the init message and a retry time, then one data: line for each message:
data: {"type":"init","name":"Demo sync","version":1,"id":"OpenSync"}
retry: 3000
data: {"id":"24nb4004pu50d","type":"application/json","channel":"orders","method":"POST","headers":{"host":"sync.example.com","user-agent":"curl/8.7.1","accept":"*/*","content-type":"application/json","content-length":"27"},"ua":"","query":{},"body":{"id":1002,"status":"paid"},"ts":"2026-11-19T08:04:51.361Z","ip":"203.0.113.10","files":[]}Each data: line holds one message. The token's channels apply, as with WebSocket.
Wrong token
With a wrong token OpenSync does not open a stream. It answers 200 with the plain text OpenSync v1. Failed attempts count toward the lock described in Access problems.
In a browser
Browsers block an EventSource to OpenSync from a page on another address, because OpenSync does not send CORS headers. In web pages, use WebSocket instead. See Listen in a web page.
Clients connected with Server-Sent Events are not listed on the Clients page.