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 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) {