SilentShardWebsocketClient

Default NetworkClient, implementing the transport over Ktor WebSockets.

It opens a session against the URL built from websocketConfig and the WebsocketAction being run, forwards the configured authentication token as the first message, and frames protocol traffic as binary and text WebSocket frames. The underlying Ktor io.ktor.client.HttpClient is created on connect and released on disconnect, so the client holds no transport resource between connections — an idle client, or one that only ran a local helper, owns nothing.

The type parameter T is the WebsocketAction subtype this client routes; connect narrows the generic action to T before dispatching. Use the class directly, or subclass it to override connect, framing, or logging while reusing the send/read machinery.

Parameters

T

the WebsocketAction subtype this client accepts.

websocketConfig

the endpoint and authentication configuration.

Constructors

Link copied to clipboard
constructor(websocketConfig: WebsocketConfig)

Functions

Link copied to clipboard
open suspend fun connect(action: T, params: String?): Unit?

suspend override fun connect(action: NetworkAction, params: String?)

Perform websocket connection with another party.

Link copied to clipboard
open suspend override fun disconnect()

Perform websocket disconnection with another party, releasing the engine that backed the connection.

Link copied to clipboard
open suspend override fun read(): ByteArray

Read mpc bytes from another party.

Link copied to clipboard
open suspend override fun send(bytes: ByteArray)

Send mpc bytes to another party.

open suspend override fun send(text: String)

Send mpc text to another party.

Link copied to clipboard
open suspend override fun sendPostRequest(action: NetworkAction, authHeader: String?, body: ByteArray): ByteArray

PostRequestCapable implementation for the ECDSA pre-sign-final step: POSTs body as application/octet-stream.

suspend fun sendPostRequest(action: NetworkAction, authHeader: String?, body: String): ByteArray

String/JSON convenience beyond the PostRequestCapable contract: test scaffolding uses it for request-response steps such as backup/export.