KtorClientLoom
Client-side Loom backed by Ktor WebSockets.
join connects directly to a WebSocketAdvertisement URL and returns a 2-peer WebSocketSeam — no intermediate contract Session adapter.
PeerId discovery:
Client's own PeerId is fixed at construction as selfPeerId and appended as
?peer=<id>on every join so the server can read it.Server's PeerId comes from WebSocketAdvertisement.serverPeerId.
Stable identity across reconnects: supplying selfPeerId gives this loom a fixed fabric identity reused on every call to weave/join. This is required for cluster-client failover: the server derives a learner NodeId from the admitted PeerId; if a reconnect mints a new random id the server admits a different learner and Raft routing breaks. The default mints a fresh random identity per loom instance (mirroring the old per-join behaviour for callers that do not need stable identity). See #544.
HttpClient lifecycle: the httpClient is not closed by this loom. Callers are responsible for closing it when all connections are done.
Parameters
Scheduler for the per-connection seam's read/write loops; the loom confines it to a single thread via limitedParallelism(1). Production default is Dispatchers.Default; tests inject kotlinx.coroutines.test.UnconfinedTestDispatcher.
The fabric identity this loom presents on every join. Defaults to a random UUID minted once at construction; supply a deterministic value for stable cluster-client identity across reconnects.