Alexandr
Alexandr

Reputation: 45

Is each browser tab its own connection when using Socket.io?

Say there are 5 open tabs in a single browser, and I am using Node.js and Socket.io. The client and server exchange packets to maintain (establish) communications.

Will connection with the client be lost if of one tab is closed?

How can I determine if the user closed the browser?

Upvotes: 2

Views: 378

Answers (1)

ATC
ATC

Reputation: 176

Yes, socket.io establishes a new connection with every tab. You're going to want to look into using session cookies to figure out which user the current socket.io connection is communicating with.

Upvotes: 2

Related Questions