Code Monkey home page Code Monkey logo

Comments (2)

mihai1voicescu avatar mihai1voicescu commented on June 11, 2024 1

For the moment I went for another route on the client, since I need just Connected and Disconnected and use the retry feature I just created a StateFlow(Disconnected) and:

  • Each time the Acceptor handler finishes state goes to Connected
  • Each time the shouldRetry callback is called state goes to Disconnected

from rsocket-kotlin.

olme04 avatar olme04 commented on June 11, 2024

Hey, thanks for an idea!

As for Client side:
We already have something similar internally to support reconnect feature. There are 3 states there: Connecting, Connected and Failed. Im all for providing some public API for it, but we also need to think about resume feature, that will come soon, and as so provide more info about state (f.e. Resuming, Resume Failed and may be something else).

As for Server side:
On current moment, with reconnect feature only, server can know only that client disconnected, this is already there, you can call ConnectionAcceptorContext.requester.coroutineContext.job.invokeOnCompletion { callback }. But with resume this can be improved, so server will know, that client may resume in near future.

I like the proposal, but on current moment I'm in progress with polishing (and breaking :) ) Public API and implementing new features like resume and lease, so I'm not sure, that it's not the best time to add such a feature.

But!
For Client side, this can be implemented externally for now.
You can look at https://github.com/rsocket/rsocket-kotlin/blob/master/rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/internal/ReconnectableRSocket.kt. This file have full logic for reconnect implementation, and if you need state preserved, you can just copy it and change return type from RSocket to ReconnectableRSocket with exposed state as some sealed class! Don't forget then not to use out-of-the-box reconnect feature.

from rsocket-kotlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.