Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Returns not unique id for cache connection #1224

Closed
wants to merge 4 commits into from

Conversation

mikhailtsai
Copy link

@mikhailtsai mikhailtsai commented Jul 26, 2018

Note: the socket.io.js file is the generated output of make socket.io.js, and should not be manually modified.

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

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

New behaviour

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 });

// After fix:
console.log(socket2_with_nsp.io.opts.path === PATH_1); // false
console.log(socket2_with_nsp.io.opts.path === PATH_2); // true

Other information (e.g. related issues)

#1225

Copy link
Member

@darrachequesne darrachequesne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor questions, else LGTM 👍

lib/index.js Outdated Show resolved Hide resolved
lib/url.js Outdated Show resolved Hide resolved
@darrachequesne
Copy link
Member

Merged (finally...) as 7a0c2b5 and included in socket.io-client@3.1.1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants