ipython/ipython — pull request #6110 by minrk (2014-07-10 22:14:16+00:00)
Title: support binary buffers in comm messages

- add buffers arg to comm Python api
- support binary websocket messages when buffers are present
- reimplement utf8 in javascript, because javascript is the best

The binary message format used on websockets:

```python
[
nbufs, # number of buffers
offset0[, offset1[, offset2...]] # offset for each buffer (nbufs offsets),
buf0 # the first buffer
[buf1,] # etc.
]
```

The numbers (nbufs and offsets) are serialized as 32b network-order integers (`struct.pack('!i')`). I imagine uint_16 would probably be plenty big enough, and any kind of uint is probably appropriate.

[demo notebook](http://nbviewer.ipython.org/gist/minrk/e838bbcd9c6db3ed3f9b)

RFC @jsongrout