Mercurial > eldonilo > lightstring
diff lightstring.js @ 6:b7a582a2b32c
add the sub-protocol (xmpp) negociation
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Sun, 15 Jan 2012 01:01:59 +0100 |
parents | 029c12b8f048 |
children | 24bc40461b2c |
line wrap: on
line diff
--- a/lightstring.js +++ b/lightstring.js @@ -58,14 +58,16 @@ Lightstring.Connection = function (aServ //"Bug 695635 - tracking bug: unprefix WebSockets" https://bugzil.la/695635 try { - this.socket = new WebSocket(this.service); + this.socket = new WebSocket(this.service, 'xmpp'); } catch(error) { - this.socket = new MozWebSocket(this.service); + this.socket = new MozWebSocket(this.service, 'xmpp'); } var that = this; this.socket.addEventListener('open', function() { + if(this.protocol !== 'xmpp') + throw "Lightstring: The server located at "+that.service+" is not XMPP aware."; var stream = "<stream:stream to='"+that.domain+"'\ xmlns='jabber:client'\