1

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?

1
  • Why would this matter? You won't be able to stop someone malicious from spoofing browsers, IP addresses, etc. But if your goal is simply to throttle traffic, just set a limit per IP (say 5-10) and use the session to limit per-user. That should do : ) Commented Dec 9, 2011 at 15:32

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

"set a maximum number of connections for an ip and allow only one connection for the same browser." -- how? an example would be appreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.