Spikard.SseEvent (spikard v0.15.4)

Copy Markdown

An individual SSE event

Represents a single Server-Sent Event to be sent to a connected client. Events can have an optional type, ID, and retry timeout for advanced scenarios.

Fields

  • event_type - Optional event type string (used for client-side event filtering)
  • data - JSON data payload to send to the client
  • id - Optional event ID (clients can use this to resume after disconnect)
  • retry - Optional retry timeout in milliseconds (tells client when to reconnect)

SSE Format

Events are serialized to the following text format:

event: event_type
data: {"json":"value"}
id: event-123
retry: 3000

Summary

Types

t()

An individual SSE event

Types

t()

@type t() :: %Spikard.SseEvent{
  data: String.t() | nil,
  event_type: String.t() | nil,
  id: String.t() | nil,
  retry: non_neg_integer() | nil
}

An individual SSE event