diff --git a/docs/pages/kotlinx-rpc/rpc.tree b/docs/pages/kotlinx-rpc/rpc.tree index 8f1c1fde5..b07239f2d 100644 --- a/docs/pages/kotlinx-rpc/rpc.tree +++ b/docs/pages/kotlinx-rpc/rpc.tree @@ -42,6 +42,7 @@ + diff --git a/docs/pages/kotlinx-rpc/topics/0-10-0.topic b/docs/pages/kotlinx-rpc/topics/0-10-0.topic new file mode 100644 index 000000000..7be9cdbdf --- /dev/null +++ b/docs/pages/kotlinx-rpc/topics/0-10-0.topic @@ -0,0 +1,32 @@ + + + + + + +

+ Version 0.10.0 brings some changes that require a migration: +

+ +
  • + waitForServices parameter in kRPC config is deprecated + and should be replaced with +
  • +
  • + As a continuation of the previous point, the backpressure mechanism is now introduced. + You may encounter slowdowns by default when using streams. + Use + to configure better suited buffer sizes. +
  • +
  • + For Ktor kRPC integration - + public fun Route.rpc functions now accept a suspending function parameter + instead of a regular one. +
  • +
    +
    diff --git a/docs/pages/kotlinx-rpc/topics/configuration.topic b/docs/pages/kotlinx-rpc/topics/configuration.topic index 18f195cb9..64a721052 100644 --- a/docs/pages/kotlinx-rpc/topics/configuration.topic +++ b/docs/pages/kotlinx-rpc/topics/configuration.topic @@ -1,6 +1,6 @@ val config: KrpcConfig.Client = rpcClientConfig { // same for KrpcConfig.Server with rpcServerConfig - waitForServices = true // default parameter + // configuration here }

    @@ -67,19 +67,54 @@ You can also define a custom format.

    - + - <code>waitForServices</code> DSL + <code>connector</code> DSL

    - waitForServices parameter is available for both client and server. - It specifies the behavior for an endpoint in situations - when the message for a service is received, - but the service is not present in KrpcClient or KrpcServer. - If set to true, the message will be stored in memory, - otherwise, the error will be sent to a peer endpoint, - saying that the message was not handled. - Default value is true. + Connector is a part of kRPC that is responsible for sending and receiving data over the network. + You can configure the following parameters:

    + +
  • + waitTimeout - timeout for waiting for a service to be registered. + Sometimes services can be registered after the server starts, + and after the first requests starts to arrive from a peer. + This parameter defines how long the server will wait for a service to be registered. +
    + The default value is Duration.INFINITE. +
    + Also, available a value of dontWait(). +
  • +
  • + callTimeout - timeout for processing one message. +
    + The default value is Duration.INFINITE. +
  • +
  • + perCallBufferSize - size of the buffer for one call. + Call can be a stream or a single message. + This effectively provides a backpressure mechanism. + If a peer is slow to process the message during a call, + the buffer will be filled up and + the sender will wait before sending more messages. +
    + Note that this is per call, not per connection. +
    + The default value is 1. +
  • +
    +

    + Example: +

    + + rpcClientConfig { + connector { + waitTimeout = 10.seconds + callTimeout = 60.seconds + perCallBufferSize = 1000 + } + } +
    diff --git a/docs/pages/kotlinx-rpc/topics/krpc-ktor.topic b/docs/pages/kotlinx-rpc/topics/krpc-ktor.topic index e28e765ee..2d6efcb21 100644 --- a/docs/pages/kotlinx-rpc/topics/krpc-ktor.topic +++ b/docs/pages/kotlinx-rpc/topics/krpc-ktor.topic @@ -25,14 +25,18 @@ val ktorClient = HttpClient { installKrpc { - waitForServices = true + serialization { + json() + } } } val rpcClient: KtorKrpcClient = ktorClient.rpc("ws://localhost:4242/services") { rpcConfig { - waitForServices = false + serialization { + protobuf() + } } } @@ -53,13 +57,17 @@ fun Application.module() { install(Krpc) { - waitForServices = true + serialization { + json() + } } routing { rpc("/services") { rpcConfig { - waitForServices = false + serialization { + protobuf() + } } registerService<MyService> { MyServiceImpl() }