# HG changeset patch # User Sonny Piers # Date 1327979554 -3600 # Node ID 5e32481b8a92c6222269cf92cfa668b49b3be887 # Parent d385975743225d587ec34220b6399c1bad5616ea Better WebSocket feature discovering and Opera support diff --git a/README b/README --- a/README +++ b/README @@ -2,6 +2,7 @@ Known support Browser: Firefox Chrome + Opera Safari iOS ...? diff --git a/lightstring.js b/lightstring.js --- 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;