ref: master
public/javascripts/vendor/strophejs-1.1.3/plugins/strophe.flxhr.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
/* flXHR plugin ** ** This plugin implements cross-domain XmlHttpRequests via an invisible ** Flash plugin. ** ** In order for this to work, the BOSH service *must* serve a ** crossdomain.xml file that allows the client access. ** ** flXHR.js should be loaded before this plugin. */ Strophe.addConnectionPlugin('flxhr', { init: function (conn) { // replace Strophe.Request._newXHR with new flXHR version // if flXHR is detected if (flensed && flensed.flXHR) { Strophe.Request.prototype._newXHR = function () { var xhr = new flensed.flXHR({ autoUpdatePlayer: true, instancePooling: true, noCacheHeader: false, onerror: function () { conn._changeConnectStatus(Strophe.Status.CONNFAIL, "flXHR connection error"); conn._onDisconnectTimeout(); }}); xhr.onreadystatechange = this.func.bind(null, this); return xhr; }; } else { Strophe.error("flXHR plugin loaded, but flXHR not found." + " Falling back to native XHR implementation."); } } }); |