Skip to content

Commit ac16ce1

Browse files
authored
Update rate-limiting.md
1 parent b8fa188 commit ac16ce1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/security/rate-limiting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ This module can work with websockets, but it requires some class extension. You
104104
export class WsThrottlerGuard extends ThrottlerGuard {
105105
async handleRequest(context: ExecutionContext, limit: number, ttl: number): Promise<boolean> {
106106
const client = context.switchToWs().getClient();
107-
// this is a generic method to switch between `ws` and `socket.io`. You can choose what is appropriate for you
108-
const ip = ['conn', '_socket']
107+
const ip = ['_socket']
109108
.map((key) => client[key])
110109
.filter((obj) => obj)
111110
.shift().remoteAddress;
@@ -120,6 +119,7 @@ export class WsThrottlerGuard extends ThrottlerGuard {
120119
}
121120
}
122121
```
122+
> info **Hint** If you using ws, it is necessary to replace the `_socket` with `conn`
123123
124124
There are some things to take keep in mind when working with websockets:
125125

0 commit comments

Comments
 (0)