class Grip::ServerSent::Stream

Defined in:

grip/server_sent/stream.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(context : HTTP::Server::Context, capacity : Int32 = 100, strategy : Strategy = Strategy::DropOldest) #

[View source]

Instance Method Detail

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

Keeps the SSE handler fiber alive by sending periodic heartbeats.


[View source]
def capacity : Int32 #

[View source]
def close : Nil #

[View source]
def comment(text : String) : self #

[View source]
def connected(connection_id : String) : self #

Protocol-level Connection Acknowledgment


[View source]
def context : HTTP::Server::Context #

[View source]
def emit(type : Event::Type, data : T = nil, *, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self forall T #

[View source]
def error(data : T = nil) : self forall T #

Protocol-level Error Emitting


[View source]
def ping : self #

Protocol-level Heartbeat


[View source]
def 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).


[View source]
def strategy : Strategy #

[View source]