multiplex on a 'channel' key in message,
rather than separate websockets.
Unlike zmq, there aren't different message patterns that require the channels to be separate.
Reduces FD count by factor of 3 and connection complexity in js.
- add debug statement at the very beginning of a web socket request
- add debug statement in open, indicating that the connection has been accepted
- add timeout, so failed or slow kernel_info doesn't cause the request to never get a response
- don't send kernel_info_request before authenticating the request
The last one required some icky coroutine shenanigans,
because of our subclass structure, but it should work fine.
WebSocket connections will not open until kernel_info is retrieved,
removing a race condition waiting for the reply to indicate adaptation,
which could result in a v5 message being sent to a v4 kernel.
The reply is cached, so that it need not be requested on each new connection.
- add buffers arg to comm Python api
- support binary websocket messages when buffers are present
- reimplement utf8 in javascript, because javascript is the best
we recently added ws pings for keep alive,
and we can now use the longs to close dead connections.
This can apparently happen when connections are not closed cleanly,
e.g. on VPNs.
Setting ws_ping_timeout = 0 disables the ping mechanism altogether.
allows setting CORS headers.
- cors_origin sets Access-Control-Allow-Origin directly
- cors_origin_pat allows setting Access-Control-Allow-Origin via regular expression, since the header spec itself doesn’t support complex access[1]
- cors_credentials sets Access-Control-Allow-Credentials: true
To allow CORS from everywhere:
ipython notebook —NotebookApp.cors_origin='*'
If websocket attempt fails and cross origin attempt is detected, a HTTPError(404) error is raised. However, in the process of closing connections because of this 404 error, an unhandled Attribute exception (kernel_id not an attribute) is raised. Setting the kernel_id first avoids this.