0

This is a general question about Socket IO, which I'm a bit unfamiliar with. I've seen a few tutorials and examples, they call seem to query the socket.io server similar to this:

https://example.com/socket.io/1/?userid=j568mfkkl3ow29&msgEvent=RTCMultiConnection-Message&socketCustomEvent=RTCMultiConnection-Custom-Message&EIO=3&transport=polling&t=LLZpEfU

What is the /1/ in the URL? I've looked through the server code and I don't see any of the code requiring it. Sometimes in my client libraries, the query does not have that /1/. What does that parameter do?

Sometimes this /1/ is not sent from the clients. I still have not found out why this parameter is sometimes sent or sometimes not sent. Can someone explain what it does?

I hope it will help my debugging.

One example would be in https://github.com/muaz-khan/RTCMultiConnection, the Video conference Demo.

l3utterfly
  • 2,106
  • 4
  • 32
  • 58

1 Answers1

0

I believe this is just a version difference. It looks like pre-1.0, socket.io used a "protocol" version in the path. See https://github.com/socketio/socket.io-client/blob/f0e877da3c48eedb399d9ebd5d55cc6888a5ace0/lib/transport.js#L222-L229:

Transport.prototype.prepareUrl = function () {
  var options = this.socket.options;

  return this.scheme() + '://'
    + options.host + ':' + options.port + '/'
    + options.resource + '/' + io.protocol
    + '/' + this.name + '/' + this.sessid;
};

io.protocol in 0.9.6, the version at the example you gave, is 1.

I don't think newer versions of socket.io have this as part of the URL path.

user94559
  • 59,196
  • 6
  • 103
  • 103