class
Radbas::ServerSentEvents::Stream
- Radbas::ServerSentEvents::Stream
- Reference
- Object
Overview
An open event stream. Safe to send to from multiple fibers.
Defined in:
radbas-framework/server_sent_events.crConstant Summary
-
HEARTBEAT =
15.seconds -
Sent while open, so proxies keep the connection and closed connections are noticed.
Constructors
Instance Method Summary
- #close : Nil
- #closed? : Bool
-
#comment(text : String = "") : Nil
Sends a comment, which clients ignore.
-
#on_close(&on_close : -> ) : Nil
Called once when the stream closes, including when the client disconnects.
-
#send(message : Message) : Nil
Sends message.
- #send(data : Iterable(String), event : String | Nil = nil, id : String | Nil = nil, retry : Int64 | Nil = nil) : Nil
-
#start : Nil
Blocks until the stream is closed.
Constructor Detail
Instance Method Detail
def comment(text : String = "") : Nil
#
Sends a comment, which clients ignore. Does nothing if the stream is closed.
def on_close(&on_close : -> ) : Nil
#
Called once when the stream closes, including when the client disconnects.
Sends message. Raises IO::Error if the stream is closed.
def send(data : Iterable(String), event : String | Nil = nil, id : String | Nil = nil, retry : Int64 | Nil = nil) : Nil
#