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

socket.id is the same in two different sessions on localhost #3651

Closed
Pedroxam opened this issue Sep 25, 2020 · 2 comments
Closed

socket.id is the same in two different sessions on localhost #3651

Pedroxam opened this issue Sep 25, 2020 · 2 comments

Comments

@Pedroxam
Copy link

Pedroxam commented Sep 25, 2020

Should the socket.id be different in the two session in localhost ?

for example in normal chrome tab and private tab, this two tab must have deffrent socket id ?

Let me be clear about this, following code must send test to 1 user, but test can send in all sockets. like io.emit.

io.on('connection', function(socket){
    socket.on('test', function(data){
           socket.emit('test');
    });
});
@darrachequesne
Copy link
Member

Yes, the socket.id is unique per connection.

@Pedroxam
Copy link
Author

Yes, the socket.id is unique per connection.

Yes, but in the localhost the socket.id is the same. anyway, i was able to solve this problem with replace socket.id with my users id.

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

No branches or pull requests

2 participants