AxonAxon is a message-oriented socket library for node.js heavily inspired by zeromq. For a light-weightUDP alternative you may be interested in punt.
Installation
$ npm install axon
Features- message oriented- automated reconnection- light-weight wire protocol- mixed-type arguments (strings, objects, buffers, etc)- unix domain socket support- fast (~800 mb/s ~500,000 messages/s)
Events
closewhen server or connection is closed-error(err) when an un-handled socket error occurs-ignored error(err) when an axon-handled socket error occurs, but is ignored-socket error(err) emitted regardless of handling, for logging purposes-reconnect attemptwhen a reconnection attempt is made-connectwhen connected to the peer, or a peer connection is accepted-disconnectwhen an accepted peer disconnects-bindwhen the server is bound-drop(msg) when a message is dropped due to the HWM-flush(msgs) queued when messages are flushed on connection-
Patterns
- push / pull- pub / sub- req / rep- pub-emitter / sub-emitter
Mixed argument types
Backed by node-amp-messageyou may pass strings, objects, and buffers as arguments.
jspush.send('image', { w: 100, h: 200 }, imageBuffer);pull.on('message', function(type, size, img){});
Push / Pull
PushSockets distribute messages round-robin:
sock.bind(3000);console.log('push server started');
setInterval(function(){sock.send('hello');
}, 150);});
}, 500);});});});});});});
}, 500);});});});