Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I handle error from autobahn? #477

Open
webdev522 opened this issue Oct 11, 2019 · 5 comments
Open

How can I handle error from autobahn? #477

webdev522 opened this issue Oct 11, 2019 · 5 comments

Comments

@webdev522
Copy link

webdev522 commented Oct 11, 2019

Hi,

I am using AutobahnJs lib for wamp on my browser.

how can I handle error if it occurs during connection, subscribe and other events?

I was going to handle errors from session.subscribe()
The following code doesn't work.

var connection = new autobahn.Connection({
       on_user_error: function (error, customErrorMessage) {
           // here comes your custom error handling, when a 
           // something went wrong in a user defined callback.
        },
        on_internal_error: function (error, customErrorMessage) {
           // here comes your custom error handling, when a 
           // something went wrong in the autobahn core.
        }
        // ... other options
    });

There are no docs related for it.

Let me know how to do it.
Any help would be appreciated.

Regards.

@DamiToma
Copy link

Any updates on this issue? I cannot find an handler for connection errors, which is something extremely important in my opinion.

@berTrindade
Copy link

@oberstet Is there anything that can be done for a situation like this ? I'm facing the same issue as @DamiToma and @webdev522. By the way, have you guys (@DamiToma, @DamiToma) found a solution?

@DamiToma
Copy link

@berTrindade I have not found a solution for that, however there's an onclose event which is fired when the connection is lost. I've found that to be enough for my use case.

@berTrindade
Copy link

@DamiToma Great! Would you mind sharing how you did it ? The code perhaps.

@DamiToma
Copy link

@berTrindade The Connection object has a onclose property.

this.connection = new autobahn.Connection({
   ...
});

this.connection.onclose = (reason, details) => {
  
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants