SSEStream
represents an open Server-Sent Events stream.
Handlers receive a reference to this and call SSEStream.send,
SSEStream.send-event or SSEStream.send-raw to
queue outgoing events. The event loop drains the outbox after the handler
returns.
The last-event-id field holds the Last-Event-ID header a reconnecting
client sent, or Nothing on a fresh stream.
last-event-id
(Fn [(Ref SSEStream a)] (Ref (Maybe String) a))
gets the last-event-id property of a SSEStream.
outbox
(Fn [(Ref SSEStream a)] (Ref (Array String) a))
gets the outbox property of a SSEStream.
send
(Fn [(Ref SSEStream a), (Ref String b)] ())
(send s value)
queues a data-only event on the stream.
send-event
(Fn [(Ref SSEStream a), (Ref String b), (Ref String c)] ())
(send-event s name value)
queues an event with a name on the stream.
send-raw
(Fn [(Ref SSEStream a), String] ())
(send-raw s chunk)
queues an already encoded block, for instance one built with
SSE.encode.
set-last-event-id
(Fn [SSEStream, (Maybe String)] SSEStream)
sets the last-event-id property of a SSEStream.
set-last-event-id!
(Fn [(Ref SSEStream a), (Maybe String)] ())
sets the last-event-id property of a SSEStream in place.
set-outbox
(Fn [SSEStream, (Array String)] SSEStream)
sets the outbox property of a SSEStream.
set-outbox!
(Fn [(Ref SSEStream a), (Array String)] ())
sets the outbox property of a SSEStream in place.
update-fd
(Fn [SSEStream, (Ref (Fn [Int] Int a) b)] SSEStream)
updates the fd property of a SSEStream using a function f.
update-last-event-id
(Fn [SSEStream, (Ref (Fn [(Maybe String)] (Maybe String) a) b)] SSEStream)
updates the last-event-id property of a SSEStream using a function f.
update-outbox
(Fn [SSEStream, (Ref (Fn [(Array String)] (Array String) a) b)] SSEStream)
updates the outbox property of a SSEStream using a function f.