class

Grip::ServerSent::Stream

Inherits Reference / Object

Constructors

new(context : HTTP::Server::Context, capacity : Int32 = 100, strategy : Strategy = Strategy::DropOldest)
Source

Instance methods

await(interval : Time::Span = 15.seconds) : Nil

Keeps the SSE handler fiber alive by sending periodic heartbeats.

Source
capacity
Source
close
Source
comment(text : String) : self
Source
connected(connection_id : String) : self

Protocol-level Connection Acknowledgment

Source
context
Source
emit(type : Event::Type, data : T = nil, *, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self forall T
Source
error(data : T = nil) : self forall T

Protocol-level Error Emitting

Source
ping

Protocol-level Heartbeat

Source
send(data : String, *, event : String | Nil = nil, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self

Formats and enqueues the payload without blocking the caller fiber (unless using strategy: Block).

Source
strategy
Source