[IPython-dev] Flushing the message buffer of a Widget

Cyrille Rossant cyrille.rossant at gmail.com
Wed Jul 23 18:50:46 EDT 2014


> We want to "flush" the message buffer of a Widget model. What is the best
> way of this when using `this.send()`? Here is the reason why:
> We are trying to do some sort of VNC backend with Vispy and IPython
> notebook. We are sending captured Javascript events to backend and send back
> PNGs to frontend. For `mouse move` event, dragging is too slow. Basically,
> when we send too many events from the notebook to the kernel, and when the
> kernel takes too much time for each event, the event queue becomes too long.
> So we want to flush the queue whenever it becomes too long.
>
> Here is an example of dragging: https://imgflip.com/gif/adwf6
> Here is the .js code sample:
> https://gist.github.com/mfkaptan/eb12cc91ee9d49f348d9

To elaborate on this: is this the right way of implementing a live
server-side visualization backend (streaming PNG images to the
browser) with IPython? What we want is to send messages back and forth
between Python and the browser, using the widget machinery rather than
comms. The throttling mechanism doesn't seem to work here (the message
queue saturates).

Also, performance-wise, it would be better if we could avoid going
through base64, and instead using binary messages directly for the PNG
images.



More information about the IPython-dev mailing list