websocket.MQ
websocket.MQ copied to clipboard
Reliable message service for websocket-based clients
websocket.MQ
Copyright 2011 by Liam Breck, Menlo Park, California License http://www.gnu.org/licenses/agpl-3.0.html
https://github.com/networkimprov/websocket.MQ
A reliable message queue service for socket-connected clients. The initial goal is to enable messaging among Node.js instances on the public net. Clients' connections are assumed to be potentially unreliable.
As with email, each message is posted with a list of recipients. A user may have multiple aliases; a single user may be sent a short message via an alias. A user may have multiple client "nodes"; messages are queued for all nodes. Distribution lists are supported. On disk, messages are stored in separate files, within transient directories for each recipient.
Components mqlib.js - message queue module. mqserver.js - example app with websocket server. Creates an mqstore/ directory in the working directory. mqclient.js - client module connecting via websocket client. mqtest.js - test client. Creates 10 clients which connect/send/disconnect. wsstream - websocket stream module
Dependencies Node.js 0.2.x https://github.com/joyent/node
Usage $ node mqserver.js & # run server in background $ node mqtest.js # run test client; stop with ctl-C $ node mqserver.js stop # stop server
Message format messages are delimited with websocket-style frames f0f {"op":"type" ...}data 1-4 hex digits, padded with 0-3 spaces, giving the size of the JSON metadata object JSON metadata arbitrary size 8-bit data
Message op types To server: register, login, listEdit, post, ping, ack To client: registered, info, quit, deliver, ack
Todo Implement user registration with email confirmation Redis(?) user database Manage inactive nodes/users SSL Email gateway with SMTP client and LMTP server