-
Notifications
You must be signed in to change notification settings - Fork 105
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
Need callback for error in connection #33
Comments
@bubooon hello! Yeah, I think it's reasonable to have, could you describe why do you specifically need this btw? |
For example, I have an important functional in my application which depend on centrifuge . If suddenly the server of the centrifuge down, I want to show an adequate message for the user and not let him use this functionality. Now it is impossible to do it, because i can't handle this error. |
Got it, thanks, will try to add during this weekend. |
@bubooon just found a time to play with your request and I wonder why not using existing centrifuge.on('disconnect', function(ctx){
console.log('Disconnected: ' + ctx.reason);
}); |
@FZambia Because i connect and disconnect to centrifuge in app and i will get this event when i disconnect manually. Better have special event when you trying connect but get error, because server is not responsing. |
Hmm, it's not as easy as I initially thought. If using raw Websockets we can add callback to |
And one more thing, i have |
Any news? |
@bubooon I am sorry for a delay - the reason why I have not just added this yet is SockJS which has no |
@bubooon please look in on_transport_close branch and this comparison - I added Example: var centrifuge = new Centrifuge({
...
onTransportClose: function(ctx) {
console.log(ctx);
}
}); |
@bubooon hi, I merged changes above into master, please reopen if it does not work for you and you still need a solution. |
@FZambia, hi, sorry for a long response, but this is not solve my issue. I need catch event, for example, when i set bad port or Centrifuge server is down. Now in this case i have error: I need just handle this case. |
I want detect, if JS client can't connect to centrifugo, but i can't do this. I have just error in console
WebSocket connection to 'ws://domain.loc:8000/connection/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Can you add some event for it?
The text was updated successfully, but these errors were encountered: