Skip to main content
api.ApplicationRealtime(appID) opens a Server-Sent Events stream and returns a *rest.RealtimeStream. Iterate it with stream.Next() until io.EOF.

Consuming the stream

Always defer stream.Close() — an unclosed stream keeps one of your account’s connection slots occupied.

Event shape

The stream emits two kinds of frames:
  • System events — connection lifecycle messages: REALTIME_CONNECTING, REALTIME_TIMEOUT, REALTIME_DISCONNECTED, REALTIME_RECONNECT and REALTIME_ERROR.
  • message events — the application payload. Data is opaque to the SDK, usually JSON — unmarshal it yourself:

Connection limits

A single account can keep at most 5 simultaneous connections open, and each connection lasts up to 10 minutes (its TTL). When the TTL is reached the stream ends with io.EOF — reconnect in a loop to stay subscribed.

Cancellation

Attach a context.Context with rest.WithContext to stop the stream from the outside: