[IPython-dev] Front end ''status_started.Kernel" event and websocket status
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 <firstname.lastname@example.org> 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?
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev