socket.io-client icon indicating copy to clipboard operation
socket.io-client copied to clipboard

[fix] Returns not unique id for cache connection

Open mikhailtsai opened this issue 8 years ago • 1 comments

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • [x] report a bug
  • [ ] request a feature

Current behaviour

Inability to work with two different socket servers and namespaces

Steps to reproduce (if the current behaviour is a bug)

const PATH_1 = '/path-1/socket.io';
const PATH_2 = '/path-2/socket.io';
const socket1 = io('http://localhost', { path: PATH_1 });
const socket2 = io('http://localhost', { path: PATH_2 });
const socket2_with_nsp = io('http://localhost/namespace', { path: PATH_2 });

// Problem:
console.log(socket2_with_nsp.io.opts.path === PATH_1); // true

Note: the best way to get a quick answer is to provide a failing test case, by forking the following fiddle for example.

Expected behaviour

console.log(socket2_with_nsp.io.opts.path === PATH_2); // true

Setup

  • OS:
  • browser:
  • socket.io version: 2.1.1

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Please, review my PR with the fix: https://github.com/socketio/socket.io-client/pull/1224

mikhailtsai avatar Jul 28 '18 13:07 mikhailtsai

Fixed by https://github.com/socketio/socket.io-client/commit/7a0c2b504f5f3bac64d423684fb1bb44229c7a70.

darrachequesne avatar Feb 03 '21 22:02 darrachequesne