From 28ddd9b3d1335a7442ab9b86c059a0a9634b451e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ing=2E=20Jan=20Kal=C3=A1b?= Date: Thu, 11 Sep 2014 14:15:10 +0200 Subject: [PATCH 1/2] open/close instead of stream:stream --- src/websocket.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/websocket.js b/src/websocket.js index bcf4208..5440dea 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -104,9 +104,8 @@ exports.createServer = function(bosh_server, options, webSocket) { wsep.on('stream-added', function(sstate) { var to = sstate.to || ''; - var ss_xml = new ltx.Element('stream:stream', { - 'xmlns': 'jabber:client', - 'xmlns:stream': 'http://etherx.jabber.org/streams', + var ss_xml = new ltx.Element('open', { + 'xmlns': 'urn:ietf:params:xml:ns:xmpp-framing', 'version': '1.0', 'xml:lang': 'en', 'from': to @@ -234,7 +233,7 @@ exports.createServer = function(bosh_server, options, webSocket) { message += XML_STREAM_CLOSE; sstate.has_open_stream_tag = true; } - } else if (message.indexOf(XML_STREAM_CLOSE) !== -1) { + } else if (message.indexOf(XML_STREAM_CLOSE) !== -1 || message.indexOf('', sstate); sstate.terminated = true; } return; @@ -280,13 +279,13 @@ exports.createServer = function(bosh_server, options, webSocket) { // The stream start node is special since we trigger a // stream-add event when we get it. var ss_node = nodes.filter(function(node) { - return typeof node.is === 'function' && node.is('stream'); + return typeof node.is === 'function' && (node.is('stream') || node.is('open')); }); ss_node = us.first(ss_node); nodes = nodes.filter(function(node) { - return typeof node.is === 'function' ? !node.is('stream') : true; + return typeof node.is === 'function' ? !(node.is('stream') || node.is('open')) : true; }); if (ss_node) { From 928fbf4dab50b3d4e47e5a1945d823c493cd2486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ing=2E=20Jan=20Kal=C3=A1b?= Date: Thu, 11 Dec 2014 16:57:42 +0100 Subject: [PATCH 2/2] Update readme Latest draft, stanza.io --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f97cf3d..d15d97b 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ if the *callback=* GET query parameter is supplied. * [http://xmpp.org/extensions/xep-0124.html](http://xmpp.org/extensions/xep-0124.html) * [http://xmpp.org/extensions/xep-0206.html](http://xmpp.org/extensions/xep-0206.html) -* [http://tools.ietf.org/html/draft-moffitt-xmpp-over-websocket-00](http://tools.ietf.org/html/draft-moffitt-xmpp-over-websocket-00) +* [https://tools.ietf.org/html/draft-ietf-xmpp-websocket-10](https://tools.ietf.org/html/draft-ietf-xmpp-websocket-10) ### Dependencies @@ -278,6 +278,7 @@ if the *callback=* GET query parameter is supplied. 4. libpurple (pidgin as a client) 5. [strophe.js websocket client] (https://github.com/superfeedr/strophejs/tree/protocol-ed) [broken link] 6. [node-xmpp] (https://github.com/astro/node-xmpp) + 7. [stanza.io] (https://github.com/otalk/stanza.io) ### Tested using