haiku-xmpp
v1.0.17
Published
An FRP XMPP library
Downloads
49
Readme
Haiku
An FRP XMPP library built on Bacon.js and Strophe
npm install haiku-xmpp
Currently this installs the source which is in ES6 and will require browserify/babel for use in browsers.
Haiku is a modern wrapper around Strophe that simplifies usage greatly, particularly when used in reactive UIs.
It handles all the callback mechanisms internally, and exposes a surface built entirely on Promises and Bacon.js streams.
Connecting to the server and listening for chats is as simple as:
var HaikuConnection = require('haiku-xmpp').HaikuConnection;
new HaikuConnection(username, password, xmpp_server)
.then(haiku => haiku.createChatStream());
This creates a Bacon.js stream that has all of the standard features.
And of course, it works brilliantly with ES6 yield:
var HaikuConnection = require('haiku-xmpp').HaikuConnection;
var haiku = yield new HaikuConnection(username, password, xmpp_server);
haiku.createChatStream().onValue(v => //do stuff when chat is received );
haiku.createPresenceStream().onValue(v => //do stuff when a contact's status changes );
Testing
Tests use karma and phantom js.
npm install
bower install
npm test OR grunt [creates file watcher for continuous testing]