i cant subscribe more than 6 channels on ie6, but with firefox or chrome i can get subscribe over 200 channel.
i try your code, dont ahve problem, but when i try with 11 or 20 or more, then fail.
example: server code
var faye = require('faye'),
http = require('http');
var bayeux = new faye.NodeAdapter({
mount: '/bayeux',
timeout: 45
});
function onRequest(request, response){};
var serverPush = http.createServer(onRequest).listen(25250);
bayeux.attach(serverPush);
var client = bayeux.getClient();
setInterval(function() {
var n = Math.floor(Math.random() * 10);
client.publish('/channels/' + n, {text: 'Hello!'});
}, 1000);
/////////////////////////////////////////////////////////////
client server
<html>
<head>
<title>Testing Push</title>
<script type="text/javascript" src="../config/faye-browser.js"></script>
<script type="text/javascript">
var client = new Faye.Client('http://192.168.20.77:25250/bayeux'),
n = 10;
while (n--)
(function(i) {
client.subscribe('/channels/' + i, function(message) {
var logs = document.getElementById('logs'),
item = document.createElement('li');
item.innerHTML = '/channels/' + i + ': ' + message.text;
logs.appendChild(item);
});
})(n);
</script>
</head>
<body>
<div id="logs"></di>
</body>
</html>
i was following the trace of /meta/subscribe/ until here....
faye-browser.js
Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
request: function(message, timeout) {
var params = {message: Faye.toJSON(message)},
head = document.getElementsByTagName('head')[0],
script = document.createElement('script'),
callbackName = Faye.Transport.JSONP.getCallbackName(),
location = Faye.URI.parse(this._endpoint, params),
retry = this.retry(message, timeout),
self = this;
Faye.ENV[callbackName] = function(data) {
cleanUp();
self.receive(data);
self.trigger('up');
};
var timer = Faye.ENV.setTimeout(function() {
cleanUp();
retry();
self.trigger('down');
}, 1.5 * 1000 * timeout);
var cleanUp = function() {
if (!Faye.ENV[callbackName]) return false;
Faye.ENV[callbackName] = undefined;
try { delete Faye.ENV[callbackName] } catch (e) {}
Faye.ENV.clearTimeout(timer);
script.parentNode.removeChild(script);
return true;
};
location.params.jsonp = callbackName;
script.type = 'text/javascript';
script.src = location.toURL();
alert(location.toURL().length); --> when the string its too long i have problem.
head.appendChild(script);
}
}), {
_cbCount: 0,
getCallbackName: function() {
this._cbCount += 1;
return '__jsonp' + this._cbCount + '__';
},
isUsable: function(endpoint, callback, context) {
callback.call(context, true);
}
});
Faye.Transport.register('callback-polling', Faye.Transport.JSONP);
i can see when the string its too long, i have problem with ie6 and ie7.
El miércoles, 5 de septiembre de 2012 19:03:29 UTC-3, James Coglan escribió:
On 4 September 2012 22:20, necro880 <wnsx...@gmail.com> wrote:
i cant subscribe more than 6 channels on ie6, but with firefox or chrome i can get subscribe over 200 channel.
i found this: http://support.microsoft.com/kb/208427
On 6 September 2012 13:45, necro880 <wnsx...@gmail.com> wrote:i found this: http://support.microsoft.com/kb/208427Right. I should make the JSON-P transport work around this, but in the meantime you can fix your problem by running the subscriptions at timed intervals: set up a few, then use setTimeout(function() { ... }, 10) to set up the next batch, and so on. If you use the same handler function for all the subscriptions, you can pass them in one call: