Island-owned bidirectional channels with ordered, resumable text and binary messages. A socket is a replaceable transport. A generation owns its endpoint, accepted input and unacknowledged output. Network changes never render islands.
Island-owned bidirectional channels with ordered, resumable text and binary messages. A socket is a replaceable transport. A generation owns its endpoint, accepted input and unacknowledged output. Network changes never render islands.
(attrs descriptor)Render the descriptor on the custom element that calls mount(element, opts).
Render the descriptor on the custom element that calls mount(element, opts).
(flush! endpoint)Returns a task waiting for peer receipt of puts committed before this call. Await put completion first to include a pending put. Receipt is neither application processing nor durable storage. Retirement fails this wait; cancelling the wait does not retract messages.
Returns a task waiting for peer receipt of puts committed before this call. Await put completion first to include a pending put. Receipt is neither application processing nor durable storage. Retirement fails this wait; cancelling the wait does not retract messages.
(use-channel k open)(use-channel k open opts)Declares a stable bidirectional channel under this island's key k.
Returns a descriptor for attrs and the browser module's mount/connect.
open takes {:channel endpoint :reason :initial|:continuity-lost
:generation id}. It runs once per generation, in its first upgrade's Scoped
scope, on a compelled task. Run the peer's receive loop in this function or
return its task (or a core.async completion channel, as returned by go).
Completion must include processing and cleanup. Ordinary reconnects retain
the identical endpoint. Continuity loss closes it, waits
for this work to finish, then calls open with a fresh endpoint.
The endpoint implements core.async ReadPort, WritePort and Channel. Take String/owned ByteBuffer messages; put String/byte[]/ByteBuffer (copied). nil is not a message. Takes return queued input, then nil after retirement. Process messages serially before taking again if processing must be ordered. Put completion means local admission, not peer receipt; use flush! for that. Full outgoing queues park puts. offer! never parks. Pending puts are FIFO, with a separate budget using the same byte/message limits as the outbox; exceeding it throws ex-info with :type :backpressure.
Unmount, revocation or core.async/close! closes both admissions. Accepted input remains readable. Outgoing data is discarded and pending puts complete true as they are drained; new puts complete false. No socket event cancels the application's task. Keep its resources through finally cleanup. Closing an endpoint does not prove application processing is finished.
Options (positive integers): :max-message-bytes 1048576, :max-queued-bytes 4194304, :max-queued-messages 64, :init-timeout-ms 10000 (transport handshake), :send-timeout-ms 10000, :ping-ms 30000, :pong-timeout-ms 10000, :resume-ms 60000. max-message-bytes must not exceed max-queued-bytes. Credits return on take. resume-ms retains a disconnected session; live SSE can retain it longer. Buffers are in memory. No traffic or status invalidates an island.
Declares a stable bidirectional channel under this island's key `k`.
Returns a descriptor for `attrs` and the browser module's mount/connect.
`open` takes {:channel endpoint :reason :initial|:continuity-lost
:generation id}. It runs once per generation, in its first upgrade's Scoped
scope, on a compelled task. Run the peer's receive loop in this function or
return its task (or a core.async completion channel, as returned by go).
Completion must include processing and cleanup. Ordinary reconnects retain
the identical endpoint. Continuity loss closes it, waits
for this work to finish, then calls open with a fresh endpoint.
The endpoint implements core.async ReadPort, WritePort and Channel. Take
String/owned ByteBuffer messages; put String/byte[]/ByteBuffer (copied).
nil is not a message. Takes return queued input, then nil after retirement.
Process messages serially before taking again if processing must be ordered.
Put completion means local admission, not peer receipt; use flush! for that.
Full outgoing queues park puts. offer! never parks. Pending puts are FIFO,
with a separate budget using the same byte/message limits as the outbox;
exceeding it throws ex-info with :type :backpressure.
Unmount, revocation or core.async/close! closes both admissions. Accepted
input remains readable. Outgoing data is discarded and pending puts complete
true as they are drained; new puts complete false. No socket event cancels
the application's task. Keep its resources through finally cleanup. Closing
an endpoint does not prove application processing is finished.
Options (positive integers): :max-message-bytes 1048576,
:max-queued-bytes 4194304, :max-queued-messages 64,
:init-timeout-ms 10000 (transport handshake), :send-timeout-ms 10000,
:ping-ms 30000, :pong-timeout-ms 10000, :resume-ms 60000.
max-message-bytes must not exceed max-queued-bytes. Credits return on take.
resume-ms retains a disconnected session; live SSE can retain it longer.
Buffers are in memory. No traffic or status invalidates an island.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |