autobahn-js
autobahn-js copied to clipboard
How can I handle error from autobahn?
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.
Any updates on this issue? I cannot find an handler for connection errors, which is something extremely important in my opinion.
@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?
@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.
@DamiToma Great! Would you mind sharing how you did it ? The code perhaps.
@berTrindade The Connection
object has a onclose
property.
this.connection = new autobahn.Connection({
...
});
this.connection.onclose = (reason, details) => {
};