Shared resilient WebSocket connection, subscription, and event-buffer manager.
Shared resilient WebSocket connection, subscription, and event-buffer manager.
(close! connection)Closes the socket, scheduler, and transport idempotently.
Closes the socket, scheduler, and transport idempotently.
(connect! connection)Opens the connection synchronously and restores desired subscriptions.
Opens the connection synchronously and restores desired subscriptions.
(create-connection
{:keys [buffer-capacity clock heartbeat-timeout-ms jitter-fn message-observer
monotonic-clock normalizer overflow-policy reconnect-base-ms
reconnect-max-ms renewal-ms restore-requests-fn scheduler sleep-fn
transport url]
:or {normalizer identity
clock (fn* [] (System/currentTimeMillis))
buffer-capacity 1024
sleep-fn (fn* [p1__3419#] (Thread/sleep p1__3419#))
heartbeat-timeout-ms default-heartbeat-timeout-ms
overflow-policy :drop-oldest
reconnect-max-ms 30000
restore-requests-fn (constantly [])
monotonic-clock (fn* [] (quot (System/nanoTime) 1000000))
jitter-fn (fn [upper] (if (pos? upper) (rand-int (inc upper)) 0))
reconnect-base-ms 250
message-observer (constantly nil)
renewal-ms default-renewal-ms}})Creates a disconnected, shareable WebSocket manager.
restore-requests-fn is called after every successful connection, enabling
freshly timestamped/signed User Data Stream subscription requests.
Creates a disconnected, shareable WebSocket manager. `restore-requests-fn` is called after every successful connection, enabling freshly timestamped/signed User Data Stream subscription requests.
(poll-event! connection)(poll-event! connection timeout-ms)Returns the next buffered event, or nil after timeout-ms.
Returns the next buffered event, or nil after timeout-ms.
(renew! connection)Schedules an immediate planned reconnect using the normal restore path.
Schedules an immediate planned reconnect using the normal restore path.
(send! connection request)Sends one JSON request map on an open connection.
Sends one JSON request map on an open connection.
(snapshot connection)Returns safe connection, subscription, and backpressure state.
Returns safe connection, subscription, and backpressure state.
(subscribe! connection stream)Adds a market stream once and subscribes immediately when connected.
Adds a market stream once and subscribes immediately when connected.
(unsubscribe! connection stream)Removes a desired market stream and sends UNSUBSCRIBE when connected.
Removes a desired market stream and sends UNSUBSCRIBE when connected.
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 |