The websocket frames are sent in either binary or text, depending on
whether there are binary buffers encoded in the message (it is a
per-message decision, not an overall decision). The decision logic is here:
https://github.com/jupyter/notebook/blob/ca50f1af5afb525fd95b98b2e61e69db28094467/notebook/base/zmqhandlers.py#L230

I think it would be very useful to have either something that can log the
messages in the kernel, right around that logic. Another interesting change
would be to have a debug switch in the notebook server that encodes any
binary message buffers with base64 so the websocket message can still be a
text websocket frame. Another place to put the logging logic is in the
frontend, after the message has been converted back into a native js object.

Jason


On Mon, Dec 18, 2017 at 6:23 AM Christian Schafmeister <
drschafmeis...@gmail.com> wrote:

> Hello,
>
> How can I control whether the jupyter server sends binary websocket frames
> vs text websocket frames to the browser?
>
> When monitoring websocket traffic between an ipython jupyter notebook
> kernel and the browser, all websocket frames, both to the browser and from
> the browser are in websocket text frames.  This makes it easy to read the
> JSON dictionaries using almost any browser.
> When monitoring websocket traffic between our Common Lisp kernel and a
> browser, the websocket frames to the browser are binary websocket frames
> and the frames from the browser are websocket text frames.
> I recently learned that it is the jupyter notebook server (written in
> python) that is interposed between our kernel and the browser that is
> carrying out this websocket communication.  Why is it using binary frames?
> Binary websocket frames are a lot harder to dig into and extract the JSON
> from.
>
> I'd like to monitor the websocket traffic between the jupyter server and
> the browser for debugging.
> It has been extremely helpful to do this in a painful/limited way to add
> jupyter widgets support to our kernel (based on cl-jupyter/Common Lisp).
>
> Best,
>
> Christian Schafmeister
> Professor
> Chemistry Department
> Temple University
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/9915a01a-5704-4671-86ce-5c33793504ee%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/9915a01a-5704-4671-86ce-5c33793504ee%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAPDWZHx0dQi0egPcJzzqmvcuqrc78tJQcnEcKKA3qjeBunh6vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to