Package-level declarations

HTTP client channel, connection factory, and error-mapping utilities for ktor-based clients.

Server-side ktor routing integration that maps incoming HTTP requests to ksrpc service calls.

Properties

Link copied to clipboard

Default mapping from ksrpc error codes to HTTP status codes used by the HTTP transport.

Link copied to clipboard

Header carrying the original ksrpc error code when the wire status maps to the default 500 fallback (i.e. the code is not present in the configured errorCodeToHttpStatus map). The client uses this to recover the exact code for @KsError-bound payload routing on the receive path. Match this constant on both ends — see also the duplicate definition in ksrpc-ktor-server's HttpStream.kt.

Link copied to clipboard

Header carrying the human-readable error message that pairs with the ksrpc error code on the wire. The body slot carries the typed errorData payload; the message moves to a header so it survives transports that strip/escape the body, and so the client can recover it cleanly even when the body decode fails.

Functions

Link copied to clipboard
fun HttpClient.asHttpChannelClient(baseUrl: String, env: KsrpcEnvironment<String>, errorCodeToHttpStatus: Map<Int, Int> = DEFAULT_KSRPC_ERROR_CODE_TO_HTTP_STATUS): ChannelClient<String>

Turn an HttpClient into a ChannelClient for a specified baseUrl.