[IPython-dev] Can I safely ignore "comm_open" for ipywidgets.CommInfo/ipython.widgets

Tom Quarendon tom.quarendon at teamwpc.co.uk
Thu Nov 19 03:00:52 EST 2015


OK, thanks.
I think that makes a little bit more sense of the ipywidgets code.
My reading of it is this.
The notebook creates a widget in the kernel. It is then expected that what that widget do is send a message to the front end where the message looks like:
{
                Comm_id: ‘uuid’,
data  : {
content {
comms:{}
}
                },
                method:”custom”
}

The comms dictionary consists of the target_name and something else that I can’t figure out. Sorry my python skills aren’t great to be able to work out what the code in CommInfo does, and since no widgets are created initially Wireshark doesn’t shed any light on the format of that part as it’s empty.
After sending that message it should then close.

So it looks like completely ignoring the message wouldn’t be ideal as it’s going to leave stuff lying around in the notebook waiting for the response. But since we don’t actually support widgets, we can just return a message as above, with an empty comms{} dictionary.

Thanks.

From: IPython-dev [mailto:ipython-dev-bounces at scipy.org] On Behalf Of Jonathan Frederic
Sent: 18 November 2015 18:19
To: IPython developers list <ipython-dev at scipy.org>
Subject: Re: [IPython-dev] Can I safely ignore "comm_open" for ipywidgets.CommInfo/ipython.widgets

Hi Tom,

If you don't plan on implementing ipywidget support in your kernel, you shouldn't have to worry about implementing that.  It's a channel used to determine what widget comms existing in the backend in order to reconnect them to the front end on page refresh.

Regarding "target_name key is not found on the receiving side", I suggest you read the comm spec here: https://github.com/ipython/ipython/wiki/IPEP-21%3A-Widget-Messages .  Basically comm handlers are registered by target_name, that's how the comms are matched accross the front end / back end boundary.

Cheers,
Jon

On Wed, Nov 18, 2015 at 8:43 AM, Tom Quarendon <tom.quarendon at teamwpc.co.uk<mailto:tom.quarendon at teamwpc.co.uk>> wrote:
When we run our kernel from a notebook the kernel gets a “comm_open” request with widget class “ipywidgets.CommInfo”, target name “ipython.widgets”.
What do we do with this?

Can I safely ignore this message and any other comm_open messages? Should I respond to any comm_open messages with a comm_close as suggested in the docs (“If the target_name key is not found on the receiving side, then it should immediately reply with a comm_close message to avoid an inconsistent state.” But it’s unclear what the “target_name key is not found on the receiving side” means).

Thanks.

_______________________________________________
IPython-dev mailing list
IPython-dev at scipy.org<mailto:IPython-dev at scipy.org>
https://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20151119/adf4e31f/attachment.html>


More information about the IPython-dev mailing list