Skip to content

docs(throttler): update WebSockets example for multiple throttle limits #3242

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Antraxmin
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Docs
  • Other... Please describe:

What is the current behavior?

Currently, the documentation for WebSockets and rate limiting provides an example of using the throttler guard with WebSockets. However, it does not take into account multiple throttle limit configurations and does not explain that the handleRequest method will be called multiple times when multiple throttler limits are set.

So, This PR updates the Throttler documentation for WebSockets to fix issue #3041. The current WebSockets example doesn't properly explain how multiple throttle limit configurations are handled, which can lead to incorrect implementations.

What is the new behavior?

  • Added a clear note explaining that handleRequest is called for each throttle configuration when multiple limits are defined
  • Created a comprehensive example showing how to properly handle multiple throttle configurations in WebSockets
  • Added module configuration example to show the complete picture
  • Added explicit return type for async methods
  • Provided comments explaining how throttler.name can be used to identify different configurations
  • Made the examples consistent with NestJS documentation style

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The documentation now clearly explains how multiple throttle limits work with WebSockets and provides a comprehensive example. Users will understand that they need to handle multiple throttle limits if they are configured, rather than just a single limit.

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.

1 participant