nteract / rx-jupyter

🎈 RxJS 5 bindings for the Jupyter Notebook API
https://nteract.io/rx-jupyter
BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

Websocket channels #9

Closed rgbkrk closed 8 years ago

rgbkrk commented 8 years ago

This completes our roundup of the kernels API. Usage:

const socketSubject = jupyter.kernels.connect(serverConfig, kernelID);

socketSubject.subscribe(message => ...);

socketSubject.send(JSON.stringify(message)); // message is a Jupyter message

Careful notes though, which bears caution of a changing API to make things easier:

In order to make this conform to the same interface we use with enchannel-zmq, it will require some extra adaptation. All that being said, this gets us started!

/cc @minrk for awareness

minrk commented 8 years ago

Cool!

It's not clear to me if we have to set these at a higher level for the server.

You shouldn't, and we probably don't even mean to be including them over the network if we are. The Python API copies msg_id and msg_type out of the header to the top-level for convenience, but this is not part of the network-level spec. A message is only a collection of dicts: header, parent_header, content, metadata; plus the buffers list. It has no top-level attributes per the spec.