Define transport types on the client side

前端 未结 2 696
自闭症患者
自闭症患者 2020-12-29 11:56

I need to use jsonp-polling for IE, and xhr-polling for Firefox, so I tried to define types of transports on the client side like this:

    if (/Firefox[\\         


        
相关标签:
2条回答
  • 2020-12-29 12:36

    The bug is now fixed in socket.io version 0.9.6, I can use this and it works fine :

    socket = io.connect(HOST_REMOTE, {
        transports: ['xhr-polling']
    });
    

    In version 1.0.0 and above:

    socket = io.connect(HOST_REMOTE, {
        transports: ['polling']
    });
    
    0 讨论(0)
  • 2020-12-29 12:48

    there is a bug in socket.io.client.

    so you can not set transports in client...

    function Socket (options) {
    this.options = {
        port: 80
      , secure: false
    ....
    };
    
    io.util.merge(this.options, options);
    ....
    };
    

    should be io.util.merge(this.options, options,0);....

    0 讨论(0)
提交回复
热议问题