Skip to content

Commit cd891da

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

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

content/security/rate-limiting.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +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-
const ip = ['_socket']
108-
.map((key) => client[key])
109-
.filter((obj) => obj)
110-
.shift().remoteAddress;
107+
const ip = ['_socket'].shift().remoteAddress;
111108
const key = this.generateKey(context, ip);
112109
const { totalHits } = await this.storageService.increment(key, ttl);
113110

0 commit comments

Comments
 (0)