Mercurial > eldonilo > lightstring
changeset 39:5e32481b8a92
Better WebSocket feature discovering and Opera support
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Tue, 31 Jan 2012 04:12:34 +0100 |
parents | d38597574322 |
children | e02bfcb78428 |
files | README lightstring.js |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/README +++ b/README @@ -2,6 +2,7 @@ Known support Browser: Firefox Chrome + Opera Safari iOS ...?
--- a/lightstring.js +++ b/lightstring.js @@ -266,11 +266,14 @@ Lightstring.Connection.prototype = { throw 'Lightstring: Connection.service is undefined.'; //"Bug 695635 - tracking bug: unprefix WebSockets" https://bugzil.la/695635 - try { + if(typeof(MozWebSocket) == "function") { + this.socket = new MozWebSocket(this.service, 'xmpp'); + } + else if(typeof(WebSocket) == "function") { this.socket = new WebSocket(this.service, 'xmpp'); } - catch (error) { - this.socket = new MozWebSocket(this.service, 'xmpp'); + else { + throw new Error('WebSocket not available.'); } var that = this;