简体   繁体   中英

Limit connected socket per computer/user in Socket.IO

How can I limit the number of connected socket per computer/user to Socket.IO server?

I know I can use session, but if the user tries to use multiple web browser then that would be useless.
IP address could also be used in this case, but if I use IP address then it would prevent other users behind the same router (same IP address) to connect to the server

Any other suggestion?

You can only limit connections by:

a) IP, which you said you don't want
b) Browser, since you can remember cookies (but if somebody opens multiple 'incognito' tabs with Chrome for example it can bypass this; also if they open another browser they can bypass this)

You cannot determine if a user is behind a router.

My suggestion:

Limit by both ip and browser: set a maximum number of connections for an ip and allow only one connection for the same browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM