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

App dies if socket disconnects right in onConnect #658

Closed
wants to merge 1 commit into from

Commits on Apr 22, 2014

  1. App dies if socket disconnects right in onConnect

    App dies if socket disconnects between in `onConnect` handler emitting the 'connect' message
    
    This is the code throwing the exception from the `emit` method
    ```js
    WebSocket.prototype.send = function(data, options, cb) {
    ...
    if (this.readyState != WebSocket.OPEN) {
        if (typeof cb == 'function') cb(new Error('not opened'));
        else throw new Error('not opened');
        return;
      }
    ...
    ```
    
    For some strange reason some times, the client socket will receive the onConnect method but will disconnect just before emitting the `connect` message, so with the above exception, the app will die!
    dotnetwise committed Apr 22, 2014
    Copy the full SHA
    96c38f8 View commit details
    Browse the repository at this point in the history