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.

copy

instantiate

(Fn [(Ref SSEStream a)] SSEStream)

copies a SSEStream.

delete

instantiate

(Fn [SSEStream] ())

deletes a SSEStream. Should usually not be called manually.

fd

instantiate

(Fn [(Ref SSEStream a)] (Ref Int a))

gets the fd property of a SSEStream.

init

instantiate

(Fn [Int, (Maybe String), (Array String)] SSEStream)

creates a SSEStream.

last-event-id

instantiate

(Fn [(Ref SSEStream a)] (Ref (Maybe String) a))

gets the last-event-id property of a SSEStream.

outbox

instantiate

(Fn [(Ref SSEStream a)] (Ref (Array String) a))

gets the outbox property of a SSEStream.

prn

instantiate

(Fn [(Ref SSEStream a)] String)

converts a SSEStream to a string.

send

defn

(Fn [(Ref SSEStream a), (Ref String b)] ())

                        (send s value)
                    

queues a data-only event on the stream.

send-event

defn

(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

defn

(Fn [(Ref SSEStream a), String] ())

                        (send-raw s chunk)
                    

queues an already encoded block, for instance one built with SSE.encode.

set-fd

instantiate

(Fn [SSEStream, Int] SSEStream)

sets the fd property of a SSEStream.

set-fd!

instantiate

(Fn [(Ref SSEStream a), Int] ())

sets the fd property of a SSEStream in place.

set-last-event-id

instantiate

(Fn [SSEStream, (Maybe String)] SSEStream)

sets the last-event-id property of a SSEStream.

set-last-event-id!

instantiate

(Fn [(Ref SSEStream a), (Maybe String)] ())

sets the last-event-id property of a SSEStream in place.

set-outbox

instantiate

(Fn [SSEStream, (Array String)] SSEStream)

sets the outbox property of a SSEStream.

set-outbox!

instantiate

(Fn [(Ref SSEStream a), (Array String)] ())

sets the outbox property of a SSEStream in place.

str

instantiate

(Fn [(Ref SSEStream a)] String)

converts a SSEStream to a string.

update-fd

instantiate

(Fn [SSEStream, (Ref (Fn [Int] Int a) b)] SSEStream)

updates the fd property of a SSEStream using a function f.

update-last-event-id

instantiate

(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

instantiate

(Fn [SSEStream, (Ref (Fn [(Array String)] (Array String) a) b)] SSEStream)

updates the outbox property of a SSEStream using a function f.