(connect connection)
(connect connection sse-options)
Initiated a SSE connection. Optionally takes SSE options which override the existing options. This allows referring to the connection object in the callbacks.
Initiated a SSE connection. Optionally takes SSE options which override the existing options. This allows referring to the connection object in the callbacks.
(-connect this)
(-connect this subscription)
(-reconnect this)
A protocol for accessing a subscription from an underlying object.
A protocol for accessing a subscription from an underlying object.
(-subscription subscriber)
(sse-connection client connection-request subscription options)
Takes HttpClient, connection request subscription specification and connection options. Returns a [[SSEConnection]] which can connect, close and reconnect.
Takes HttpClient, connection request subscription specification and connection options. Returns a [[SSEConnection]] which can connect, close and reconnect.
(sse-flow-subscriber
{:keys [on-complete on-error on-next on-subscribe]
:or {on-complete noop on-error noop on-next identity on-subscribe noop}})
Create a [[SSEFlowSubscriber]] with callbacks similar to a [[Flow$Subscriber]] with slight differences:
on-complete
: called when the flow completes with an internal state.
on-subscribe
: called on subscription with an internal state.
on-next
: Unlike a [[Flow$Subscriber]], called when an SSE event is
emitted from the buffer with the event as an argument.
on-next
SHOULD return a truth-y value. A false-y value will cause
events to stop being consumed.
on-error
: Called with the internal state and a Throwable.
The returned subscriber also implements ISubscriber
, exposing
its internal [[Flow$Subscription]], and [[ISSE]] which defines how the
next SSE event must be handled.
Create a [[SSEFlowSubscriber]] with callbacks similar to a [[Flow$Subscriber]] with slight differences: `on-complete`: called when the flow completes with an internal state. `on-subscribe`: called on subscription with an internal state. `on-next`: Unlike a [[Flow$Subscriber]], called when an SSE event is emitted from the buffer with the event as an argument. `on-next` SHOULD return a truth-y value. A false-y value will cause events to stop being consumed. `on-error`: Called with the internal state and a Throwable. The returned subscriber also implements [[ISubscriber]], exposing its internal [[Flow$Subscription]], and [[ISSE]] which defines how the next SSE event must be handled.
(sse-subscription client request opts)
Initialize a SSE subscription with client
according to request
and opts
.
opts
are passed to sse-flow-subscriber
.
Returns a tuple of [CompletableFuture<Response> ISubscriber
].
It's worth considering the future won't be completed until the end of
the response. If the subscription is expected to go on for a while,
don't block a thread waiting for completion.
Initialize a SSE subscription with `client` according to `request` and `opts`. `opts` are passed to [[sse-flow-subscriber]]. Returns a tuple of [CompletableFuture<Response> [[ISubscriber]]]. It's worth considering the future won't be completed until the end of the response. If the subscription is expected to go on for a while, don't block a thread waiting for completion.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close