XMPP For The Web World?
The goal of XMPP-FTW is to make XMPP really simple to use for (web) developers
Written in nodejs
Proxy between XMPP server + browser
Doesn't mandate a transport
Acts as an XMPP client (using `node-xmpp`)
Can be run in the browser too
var socket = new Primus('127.0.0.14000')
socket.on('online', function() {
console.log('i haz websocket')
socket.emit('xmpp.login', credentials)
socket.on('xmpp.connection', function() {
// Now we can do all the things!
})
})
socket.emit(
'xmpp.chat.message',
{
"to": "other@evilprofessor.co.uk",
/* "content": "Hello world", */
/* "format": "plain", */
/* "state": "composing" */
}
)
socket.on('xmpp.chat.message', function(data) {
console.log(data)
})
(Payloads where a response will be received)
socket.emit(
'xmpp.area.specific',
{
"your": "payload"
},
function(error, data) { console.log(error, data) }
)
Apply standard key names and formats across XMPP messages for convenience and familiarity
socket.emit(
'xmpp.discover.info',
{
"of": "evilprofessor.co.uk"
},
function(error, features) {
console.log(error, features)
}
)
Head over to 127.0.0.14000/demo
xmpp.login
{
"jid": "<user>@evilprofessor.co.uk",
"password": "password",
"register": true,
"host": "localhost"
}
xmpp.pubsub.publish
{
"to": "pubsub.evilprofessor.co.uk",
"node": "xmpp-ftw updates",
"content": "<your name in lights?>"
}
xmpp.pubsub.retrieve
{
"to": "pubsub.evilprofessor.co.uk",
"node": "xmpp-ftw updates"
}
Hint: Ctrl/Cmd + Click to enlarge results
Tell the server we're here & listening...
xmpp.presence
{}
xmpp.pubsub.subscribe
{
"to": "pubsub.evilprofessor.co.uk",
"node": "xmpp-ftw updates"
}
Items are now received via the xmpp.pubsub.push.item event
...and what did we just do?
...a web-app without a backend?
npm i xmpp-ftw-demo npm start open http://localhost:3000
...or...
Hosted for free by nodejitsu under the open source scheme. Please show them some ❤