0.2.2 • Published 5 years ago
@xatellite/jxmpp v0.2.2
JXMPP
This is a simple abstraction over jxmpp, which provides some convenient function so you don't have to deal with xml and xmpp directly.
Usage
To use this library in Node, you first have to register CoffeeScript.
require 'coffeescript/register'
JXMPP = require './jxmpp'
After that, you have to define callbacks for messages and presence updates.
message_callback = function (from, message) {}
presence_callback = function (from, type, show, status) {}
Now you can instatiate the xmpp class
jxmpp = JXMPP(message_callback, presence_callback)
To send a new message, simply call
jxmpp.send("user@example.com", "Hello World!")
And finally, to update your presence status, run
jxmpp.available("Status message") // Status message is optional
jxmpp.unavailable("<show>", "Status message") // Status message is optional
where is required and one of
["dnd", "away", "xa"]