Wampa
Bi-directional, evented, websocketed, JSON RPC.
It's kinda like WAMP, but not really.
And the name Wampa
wasn't taken, so I jumped on it!
(insert pic of me riding a wampa)
The whole thing sits on top of the ws
module and provides some sugar and a tiny bit of convenience for the RPC-ish stufff.
Install
npm install wampa
Test
npm test
-or-
mocha
Usage
server.js
var Wampa = http = ; var server = http; var wampaServer = server: server path: '/wampa' ; wampaServer; server;
client.js
var Wampa = ; var socket = 'http://localhost:8000/wampa'; socket;
Events
See https://github.com/einaros/ws/blob/master/doc/ws.md for the details of ws
events.
Wampa.Server === ws.Server()
Wampa.Client === ws()
socket.on('expose', function([FnNames]) { });
Methods
Socket.expose({})
- Accepts an object of functions to expose to the connected socket.Socket.run.<exposed fn>
- Triggers exposed functions on the connected socket.Socket.sendEvent('blargh'[, args ])
- Sendsblargh
event with optionalargs
to connected socket.
Examples
Look in the examples/
folder to see the good stuff.
Versions
0.0.5
- Fixed the failing tests
0.0.4
- Started keeping track
- Added rudimentary pub/sub