problem with ie6

60 views
Skip to first unread message

necro880

unread,
Sep 4, 2012, 5:20:11 PM9/4/12
to faye-...@googlegroups.com
i cant subscribe more than 6 channels on ie6, but with firefox or chrome i can get subscribe over 200 channel.

what can i do?

i need this work on ie6.

Thanks

James Coglan

unread,
Sep 5, 2012, 6:03:28 PM9/5/12
to faye-...@googlegroups.com
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 can't reproduce this. I just ran this code in the browser:

    var client = new Faye.Client('http://10.0.2.2:8000/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);

And it receives all the messages published by this script:

    var faye = require('../../build/node/faye-node'),
        client = new faye.Client('http://localhost:8000/bayeux');

    setInterval(function() {
      var n = Math.floor(Math.random() * 10);
      client.publish('/channels/' + n, {text: 'Hello!'});
    }, 1000);

Can you reproduce this using your Faye server? What code are you trying to run in the browser that fails when running in IE6?
Message has been deleted

necro880

unread,
Sep 6, 2012, 8:43:30 AM9/6/12
to faye-...@googlegroups.com
sorry i forgot change on server:

var n = Math.floor(Math.random() * 20);

on client.

n      = 10;




El jueves, 6 de septiembre de 2012 09:40:46 UTC-3, necro880 escribió:
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.

necro880

unread,
Sep 6, 2012, 8:43:58 AM9/6/12
to faye-...@googlegroups.com
sorry i forgot change on server:

var n = Math.floor(Math.random() * 20);

on client.

n      = 20;

necro880

unread,
Sep 6, 2012, 8:45:37 AM9/6/12
to faye-...@googlegroups.com

James Coglan

unread,
Sep 6, 2012, 10:08:20 AM9/6/12
to faye-...@googlegroups.com
On 6 September 2012 13:45, necro880 <wnsx...@gmail.com> wrote:
i found this: http://support.microsoft.com/kb/208427

Right. 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:

client.subscribe(['/channels/1', '/channels/2', ...], function() {})

This reminds me, the spec allows multiple subscriptions to be specified in one wire message, but I took this out of Faye because CometD didn't support it last time I checked. I'll give it another go since it will reduce the volume of data in the subscription requests. 

James Coglan

unread,
Sep 8, 2012, 10:22:59 AM9/8/12
to faye-...@googlegroups.com
On 6 September 2012 16:08, James Coglan <jco...@gmail.com> wrote:
On 6 September 2012 13:45, necro880 <wnsx...@gmail.com> wrote:
i found this: http://support.microsoft.com/kb/208427

Right. 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:

Reply all
Reply to author
Forward
0 new messages