[IPython-dev] Front end ''status_started.Kernel" event and websocket status

MinRK benjaminrk@gmail....
Wed Aug 21 02:47:14 CDT 2013


See Pull Request #4079 <https://github.com/ipython/ipython/pull/4079>.

On Wed, Aug 21, 2013 at 2:29 AM, Stephen Chan <sychan@lbl.gov> wrote:

    I've been doing some front end work on the notebook and started
> using the status_started.Kernel event to push authentication tokens
> from the browser to the ipython kernel for use in 'backend' code.
>
>    The browser code initializes before IPython.notebook.kernel is
> initialized, so I bound handler to status_started.Kernel to wait for
> the kernel to come up before calling IPython.notebook.kernel.execute()
>    The problem is that when I call IPython.note.kernel.execute() I am
> getting a DOM error that the web socket is not in readyState 1. It
> looks like the websocket constuctors in
> Kernel.prototype.start_channels() are non-blocking and return before
> the shell_channel is ready for a send(). This is happening on the
> latest Chrome (haven't tried it on FF or Safari yet).
>
>    I'm kludging around this currently by checking the readyState on
> the shell_channel, and if it isn't ready, using setTimeout for 500ms
> before calling IPython.notebook.kernel.execute()
>
>    There's an event for websocket closed, but not one for websocket
> opening. Would it make sense to either add another event for the
> websocket, or else only trigger the status_started.Kernel event once
> all the websockets are up? Is there another way to deal with this?
>
>    Thanks,
>    Steve
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130821/ae9bbcb0/attachment.html 


More information about the IPython-dev mailing list