Skip to content
This repository

If a notebook loses its network connection WebSockets won't reconnect #1577

Closed
ellisonbg opened this Issue April 12, 2012 · 5 comments

4 participants

Brian E. Granger Fernando Perez Roy Hyunjin Han Matthias Bussonnier
Brian E. Granger
Owner

If a computer running the notebook client in a browser loses its network connection to the notebook server, it is unable to later reconnect after the connection is reestablished. The non WebSocket connections work fine, but we need to add custom logic that auto-reconnects the WebSockets.

Roy Hyunjin Han

I added a quick workaround for the time being.
invisibleroads/ipython@9995f2a

Kernel.prototype._websocket_closed = function(ws_url, early){
    var msg;
    var parent_item = $('body');
    if (early) {
        msg = "Websocket connection to " + ws_url + " could not be established." +
        " You will NOT be able to run code." +
        " Your browser may not be compatible with the websocket version in the server," +
        " or if the url does not look right, there could be an error in the" +
        " server's configuration.";
    } else {
        this._handle_start_kernel({
            ws_url: ws_url,
            kernel_id: this.kernel_id
        }, $.proxy(IPython.notebook.kernel_started, IPython.notebook));
        return;
    }
Roy Hyunjin Han

The following quickfix does resolve the issue, although it's not pretty because it references IPython.notebook inside kernel.js, which doesn't follow the convention where such references are only in notebook.js
invisibleroads/ipython@d9c55ca

    if (early) {
        msg = "Websocket connection to " + ws_url + " could not be established." +
        " You will NOT be able to run code." +
        " Your browser may not be compatible with the websocket version in the server," +
        " or if the url does not look right, there could be an error in the" +
        " server's configuration.";
    } else {
        this._handle_start_kernel({
            ws_url: this.ws_url,
            kernel_id: this.kernel_id
        }, $.proxy(IPython.notebook.kernel_started, IPython.notebook));
        return;
    }
Brian E. Granger
Owner
Roy Hyunjin Han

Please let me know when the branch referenced in #1711 is merged. There are other user interface enhancements that I would like to make.

Matthias Bussonnier
Collaborator

Please let me know when the branch referenced in #1711 is merged. There are other user interface enhancements that I would like to make.

@invisibleroads , #1711 has been merged a few hours ago.

Fernando Perez fperez closed this in 41f79e7 June 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.