fast-twitch.client.core
Complete generated reference for fast-twitch.client.core
Using this namespace
(ns application.client
(:require [cljs.core :refer [await]]
[fast-twitch.client.core :as client]))
Use request! for HTTP/Fetch SSE and connect! for TCP/WebSocket/native EventSource. message-channel! creates local ports. read-body! and read-stream! collect; reduce-stream! consumes incrementally. TCP peers use send/receive/half-close; WebSocket and ports receive events through callbacks.
Complete option and return-value tables · Reader settings.
| Learn by running | What to inspect |
|---|---|
| HTTP forwarding | Native response carrier, map edits and decoding |
| WebSocket echo | Route upgrade, open readiness and message callbacks |
| SSE | Per-request producer state and two consumer lifetimes |
| Streams | Owned cancellation and split UTF-8 decoding |
| MessageChannel | JSON encoding and closing both ports |
| TCP | EOF, half-close and bounded receive |
The function reference below retains every upstream signature, docstring and source link. The guides explain the settings that signatures alone cannot show.
Upstream function reference
Native clients configured with ordinary request and option maps.
close!
(close! handle)
(close! handle options)
Function.
Closes a socket or owned connection/port/source. WebSocket options: :code/ :reason; other connection handles accept no close options. Source
connect!
(connect! endpoint options)
Function.
Connects an endpoint map according to :transport (:tcp, :websocket or :event-source). TCP supports :codec :native/:bytes/:text and :streaming bounded reader settings, with optional :runtime/:tls?/:signal. receive! reads through EOF, without framing. WebSocket uses its native message codec and :protocols/:listener/:on-event/:signal; streaming and other codecs are rejected. It resolves to the socket on open; use send! and close! with that handle. EventSource uses :url/:on-event and optional :event-types/:with-credentials?. Native adapters are selected internally. Source
half-close!
(half-close! connection)
Function.
Ends TCP writes while retaining reads. Source
message-channel!
(message-channel!)
(message-channel! options)
Function.
Creates a native MessageChannel. :codec (:native or :json) configures both ports; optional :on-event receives port2 messages. Returns :port1/:port2 handles. Source
read-body!
(read-body! message)
(read-body! message options)
Function.
Reads a request/response body with :codec and bounded reader options. Source
read-stream!
(read-stream! stream)
(read-stream! stream options)
Function.
Reads a native readable stream with :codec and bounded reader options. Source
receive!
(receive! connection)
Function.
Collects a TCP connection through EOF using its configured codec/streaming limits. WebSocket and message-port messages use their event listeners. Source
reduce-stream!
(reduce-stream! stream reducer initial)
(reduce-stream! stream reducer initial options)
Function.
Reduces bytes, or incremental UTF-8 text with :codec :text, awaiting the reducer. Borrowed readers release locks; owned readers cancel on early termination or failure. Source
request!
(request! request)
(request! request options)
Function.
Fetches a request map according to configuration. :transport is :http (default) or :sse. HTTP supports :codec :native/:bytes/:text/:json, :request-init, :streaming and middleware sequences. SSE uses :on-event, :signal and streaming :max-line-bytes/:max-event-bytes, with its native event-map codec. Source
send!
(send! handle data)
(send! handle data options)
Function.
Sends data through a configured TCP connection, native WebSocket, or message port. TCP :text encodes UTF-8; byte codecs preserve native bytes. Optional :transfer applies only to message ports. No framing or peer receipt is implied. Source