ChannelHost

A SerializedChannel that can host sub-services.

This could be a bidirectional conduit like a Connection, or it could be a hosting only service such as http hosting.

Inheritors

Properties

Link copied to clipboard
Link copied to clipboard
abstract val env: KsrpcEnvironment<T>

Functions

Link copied to clipboard
abstract suspend fun call(channelId: ChannelId, endpoint: String, data: CallData<T>): CallData<T>
Link copied to clipboard
abstract suspend fun close()
abstract suspend fun close(id: ChannelId)
Link copied to clipboard
abstract suspend fun onClose(onClose: suspend () -> Unit)

Add a callback to be invoked when SuspendCloseable.close is called.

Link copied to clipboard
abstract suspend fun registerDefault(service: SerializedService<T>)

Register the primary service to be hosted on this communication channel.

Link copied to clipboard
inline suspend fun <T : RpcService, S> SingleChannelHost<S>.registerDefault(service: T)
suspend fun <T : RpcService, S> SingleChannelHost<S>.registerDefault(service: T, obj: RpcObject<T>)

Register a service to be hosted on the default channel.

Link copied to clipboard
abstract suspend fun registerHost(service: SerializedService<T>): ChannelId

Add a serialized service that can receive calls on this channel with the returned ChannelId. The calls will be allowed until close is called.

Link copied to clipboard
inline suspend fun <T : RpcService, S> ChannelHost<S>.registerHost(service: T): ChannelId
suspend fun <T : RpcService, S> ChannelHost<S>.registerHost(service: T, obj: RpcObject<T>): ChannelId

Register a service to be hosted, the ChannelId ollocated to this service is returned. Generally this should not be called directly, as it will happen automatically when services are returned from KsMethod tagged methods.