class
Grip::ServerSent::Stream
- Grip::ServerSent::Stream
- Reference
- Object
Defined in:
grip/server_sent/stream.crConstructors
Instance Method Summary
-
#await(interval : Time::Span = 15.seconds) : Nil
Keeps the SSE handler fiber alive by sending periodic heartbeats.
- #capacity : Int32
- #close : Nil
- #comment(text : String) : self
-
#connected(connection_id : String) : self
Protocol-level Connection Acknowledgment
- #context : HTTP::Server::Context
- #emit(type : Event::Type, data : T = nil, *, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self forall T
-
#error(data : T = nil) : self forall T
Protocol-level Error Emitting
-
#ping : self
Protocol-level Heartbeat
-
#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).
- #strategy : Strategy
Constructor Detail
def self.new(context : HTTP::Server::Context, capacity : Int32 = 100, strategy : Strategy = Strategy::DropOldest)
#
Instance Method Detail
def await(interval : Time::Span = 15.seconds) : Nil
#
Keeps the SSE handler fiber alive by sending periodic heartbeats.
Protocol-level Connection Acknowledgment
def emit(type : Event::Type, data : T = nil, *, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self forall T
#