I was thinking something along these lines:

```javascript
function Socket(type) {
  this.type = type;
  this._zmq = new zmq.Socket(defaultContext(), types[type]);
  this.isReady = false;
  var that = this;
  this._zmq.onReady = function () {
    that._flush();
    that.isReady = true;
  };
  this._outgoing = [];
  this._shouldFlush = true;
};
```

```javascript
Socket.prototype.send = function(msg, flags) {
  ...
if (this.isReady && !(flags & zmq.ZMQ_SNDMORE)) this._flush();
  ...
};
```