Package-level declarations
Transport-agnostic abstractions: Connection, SerializedService, ChannelHost, RpcBinaryData, CallData, RpcCallId, CancellationSupport, and WireContextMap. These interfaces form the contract that every transport module implements.
Types
RpcBinaryData backed by an in-memory ByteArray. Avoids all streaming and coroutine overhead — transferTo delivers the entire buffer in a single callback, and toByteArray returns the array directly.
Transport-level cancellation primitive.
A SerializedChannel that can call into sub-services.
A SerializedChannel that can host sub-services.
A bidirectional channel that can both host and call services/sub-services.
Generic interface for things that hold a context that is used when interacting with them.
Coroutine-context element describing the RPC call currently being handled by a ksrpc dispatcher. Installed at the single chokepoint where the user's handler body is invoked (RpcMethod.call) so that the handler can introspect its own call identity (for correlating progress notifications, streaming side-channels, etc.) via currentRpcCall.
Transport-agnostic binary data source. Implementations adapt user-facing types (ByteReadChannel, kotlinx.io.Source, okio.BufferedSource, ...) to a shape the ksrpc wire protocol can consume.
A multi-channel interface for serialized communication, generally shouldn't need to interact directly with this, instead use either ChannelClient or ChannelHost to reference a SerializedService instead.
Serialized version of a service. This can be transformed to and from a service using serialized and SerializedService.toStub.
A wrapper around a communication pathway that can be turned into a primary SerializedService.
A bidirectional channel that can host one service in each direction (1 host and 1 client).
A wrapper around a communication pathway that can be turned into a primary SerializedService.
An RpcCallId wrapper that carries a WireContextMap alongside the original (possibly null) call id. Used by com.monkopedia.ksrpc.RpcMethod.callChannel to forward wire-encoded context values through the call chain without depending on coroutine context propagation, which may not survive through intermediate withContext switches in the in-process channel path.
Coroutine-context element that carries wire-encoded @KsContext values through the call chain. The stub-side com.monkopedia.ksrpc.RpcMethod.callChannel builds a WireContextMap from the caller's coroutine context (encoding each present com.monkopedia.ksrpc.KsContextBinding via toWire) and installs it so transports can read the values and propagate them across the wire.
Functions
Await response and, if the awaiting coroutine is cancelled before completion, invoke CancellationSupport.sendCancel for callId before re-throwing.
Connects both default channels for a connection (incoming and outgoing).
Raw version of connect, performing the same functionality with SerializedService directly.
Returns the CurrentRpcCallElement installed by the dispatcher for the currently executing handler, or null when not running inside an RPC handler.
Register a service to be hosted on the default channel.
Utility to bind the currently executing coroutine's Job to callId on a CancellationSupport so that an incoming remote cancel signal cancels this coroutine.