3

I am using RSocket channel and trying to implement resume functionality, in case the connection to the server is lost. After trying different combinations of resume(), resumeSessionDuration(), resumeStreamTimeout() and resumeCleanupOnKeepAlive() /documentation: https://javadoc.io/static/io.rsocket/rsocket-core/1.0.0-RC3/io/rsocket/RSocketFactory.ServerRSocketFactory.html#resume--/ on the server and the mobile device, still nothing happens. On the mobile device I send data to the server each 10 seconds and when the connection is lost, the socket is disposed at the 3rd retry. Does anyone know what all these methods exactly do server- and client-side? There is almost no documentation at all...

This is the code on the server:

RSocketFactory.receive()
                    .resume()
                    .acceptor((setupPayload, reactiveSocket) -> Mono.just(responseHandler))
                    .transport(TcpServerTransport.create(buildSecuredTcpServer(address, port, 
                    sslContext)))
                    .start()
                    .block();

The is the code on the mobile device:

 socket = RSocketFactory.connect()
        .errorConsumer(throwable -> {
            if (throwable instanceof RejectedResumeException){
                Log.d("tagg", "error: " + throwable.getMessage());
            }
        })
        .resume()
        .resumeStreamTimeout(Duration.ofSeconds(120))
        .resumeSessionDuration(Duration.ofSeconds(600))
        .keepAlive(Duration.ofSeconds(120), Duration.ofSeconds(120), 120)
        .resumeStrategy(() -> new PeriodicResumeStrategy(Duration.ofSeconds(1)))
        .metadataMimeType(BuildConfig.RSOCKET_METADATA_MIME_TYPE)
        .dataMimeType(BuildConfig.RSOCKET_DATA_MIME_TYPE)
        .transport(TcpClientTransport.create(tcpClient))
        .start()
        .block();
Objects.requireNonNull(socket)
        .requestChannel(Flux.from(this::onSubscribe))
        .doOnNext(this::receiveData)
        .retryBackoff(Integer.MAX_VALUE, Duration.ofSeconds(1))
        .subscribe();

0 Answers0