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

"Implement connection limit for WebSocket connections" #64

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

ksysoev
Copy link
Owner

@ksysoev ksysoev commented Jun 2, 2024

This pull request adds the ability to limit the number of active WebSocket connections in the ConnectionRegistry. It introduces a new method, CanAccept(), which checks if the registry can accept new connections based on the specified connection limit. If the connection limit is reached, a "Connection limit reached" error message is returned. The AddConnection() method has been updated to check the connection limit before adding a new connection. Additionally, a new option, WithConnectionLimit(), has been added to set the maximum number of connections that can be accepted by the ConnectionRegistry.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 89.28571% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 90.63%. Comparing base (51aea57) to head (25bdd6b).

Files Patch % Lines
channel/channel.go 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
+ Coverage   89.24%   90.63%   +1.39%     
==========================================
  Files          20       20              
  Lines         818      844      +26     
==========================================
+ Hits          730      765      +35     
+ Misses         66       58       -8     
+ Partials       22       21       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ksysoev ksysoev merged commit a5684ca into main Jun 2, 2024
1 check passed
@ksysoev ksysoev deleted the 54-limit-number-of-concurrent-connections branch June 2, 2024 09:54
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.

2 participants