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

SHARD-1058: Add per-IP connection limit to WebSocket server #97

Merged
merged 6 commits into from
Jan 3, 2025

Conversation

S0naliThakur
Copy link
Member

@S0naliThakur S0naliThakur commented Dec 16, 2024

Linear: https://linear.app/shm/issue/SHARD-1058

Summary:

  1. Introduced a new configuration option maxConnectionsPerIP to limit the number of concurrent WebSocket connections from a single IP address.
  2. Updated the onConnection function to check the number of active connections per IP and close the socket if the limit is reached.
  3. Periodic cleanup of stale connections.
  4. Modified unit tests to accommodate the new IP connection limit functionality.

src/config.ts Outdated Show resolved Hide resolved
src/websocket/index.ts Outdated Show resolved Hide resolved
src/websocket/index.ts Outdated Show resolved Hide resolved
test/unit/websocket/index.test.ts Outdated Show resolved Hide resolved
src/websocket/index.ts Show resolved Hide resolved
aniketdivekar
aniketdivekar previously approved these changes Dec 26, 2024
src/websocket/index.ts Outdated Show resolved Hide resolved
aniketdivekar
aniketdivekar previously approved these changes Dec 30, 2024
src/websocket/index.ts Outdated Show resolved Hide resolved
aniketdivekar
aniketdivekar previously approved these changes Dec 30, 2024
urnotsam
urnotsam previously approved these changes Dec 30, 2024
@aniketdivekar aniketdivekar merged commit 28bdf82 into dev Jan 3, 2025
7 checks passed
@aniketdivekar aniketdivekar deleted the perIPrateLimit branch January 3, 2025 09:24
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.

4 participants