KrpcTransport
An abstraction of transport capabilities for KrpcClient and KrpcServer.
For developers of custom transports:
The implementation should be able to handle both binary and string formats, though not necessary if you absolutely sure that only one will be supplied and received.
The KrpcClient and KrpcServer suppose that they have an exclusive instance of transport. That means that each client or/and server should have only one transport instance, otherwise some messages may be lost or processed incorrectly.
CoroutineScope is used to define connection's lifetime. If canceled, no messages will be able to go to the other side, so ideally, it should be canceled only after its client or server is.
A good example of the implementation is KtorTransport, that uses websocket protocol to deliver messages.
Functions
Suspends until the next RPC message from a peer endpoint is received and then returns it.
Suspends until the next RPC message from a peer endpoint is received and then returns it.
Sends a single encoded RPC message over a network (or any other medium) to a peer endpoint.