GithubHelp home page GithubHelp logo

Comments (6)

oberstet avatar oberstet commented on July 20, 2024

Similar to: crossbario/autobahn-java#24

from autobahn-js.

danielfaust avatar danielfaust commented on July 20, 2024

I think that the auto-resubscribe should be optional, and disabled by default. The reconnect will trigger a onOpen, which is the place where prefix setup and subscribing usually takes place, at least in the demo code provided, so there will be some kind of action duplication.

Maybe the auto-reconnect should limit itself to discovering the disconnection - which always fires an onClose - and attempting to reconnect, so that the user of the library doesn't have to code this. A reconnect should then behave just like a first time connect. Eventually a flag could be set in a variable which could be queried to see if the onOpen was triggered by an automatic reconnect (or pass it as an argument) and possibly if an onClose will trigger reconnection attempts in the future, which could be useful to display an "attempting to reconnect..." message to the user.

Another thing is that this issue doesn't seem to be similar to the AutobahnAndroid problem, since there a manual subscription in an onOpen triggered by an automatic reconnect doesn't seem to be working at all.

from autobahn-js.

oberstet avatar oberstet commented on July 20, 2024

I no longer think is worth / necessary ..

from autobahn-js.

activeperception avatar activeperception commented on July 20, 2024

Hi,

I'm finding this to be an issue in my application and can't think of any other way to go about it.

In a decently sized application you would expect the registration / subscriptions to be 'distributed' across multiple classes/components/controllers therefore not all re-registration can happen in the onopen method.

For our app we're storing the registrations/subscriptions in a AngularJS factory that also abstracts all controllers from Autobahn details. On reconnect we iterate through the stored registrations/subscriptions and re-register...this is something that can probably be done in an easier and cleaner way internally by autobahn using session.subscriptions and session.registrations. What do you think?

/Raffaele

from autobahn-js.

oberstet avatar oberstet commented on July 20, 2024

The session is destroyed when the connection is lost. Upon (automatic) reconnection, a new session object is created. I don't think scattering subscribe/register over classes is a good approach. But then, I don't know much about AngularJS. So I would need to have to look at a (larger) Angular/WAMP application to get a "feeling" for where the issues are. We have done large apps using AutobahnJS and Knockout, and there, we didn't have issues.

from autobahn-js.

activeperception avatar activeperception commented on July 20, 2024

Hi,

Ultimately I solved the maybe-Angular-specific-issue by using the following wrapper: https://github.com/voryx/angular-wamp . I leave it here in case anyone else has a similar problem

/Raffaele

from autobahn-js.

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.