JustinTulloss/zeromq.node — pull request #288 by tcr (2014-03-09 20:10:29+00:00)
Title: Adds Socket::encode and Socket::decode hooks.

This patch would add a "Socket::encode" and "Socket::decode" hook used for values received by "Socket::send" and emitted by "Socket::on('message)", respectively. By default, the prototype functions just return the values they receive.

This feature is debatable, but with it I'd find it very easy to, for example, use [structured clone](https://github.com/tessel/structured-clone) to hook in rich data types instead of just buffers:

```js
var zmq = require('zmq');
var clone = require('structured-clone');
zmq.SocketConstructor.prototype.encode = clone.serialize
zmq.SocketConstructor.prototype.decode = clone.deserialize
```