Browse Source

SYSTEM | Log

pull/1/head
Vitalik 1 year ago
parent
commit
589c51426b
  1. 2
      src/domain/real-time/guards/ws-throtler.guard.ts

2
src/domain/real-time/guards/ws-throtler.guard.ts

@ -5,6 +5,8 @@ import { ThrottlerException, ThrottlerGuard } from '@nestjs/throttler' @@ -5,6 +5,8 @@ import { ThrottlerException, ThrottlerGuard } from '@nestjs/throttler'
export class WsThrottlerGuard extends ThrottlerGuard {
async handleRequest(context: ExecutionContext, limit: number, ttl: number): Promise<boolean> {
const client = context.switchToWs().getClient()
console.log('conn', client.conn)
console.log('socket', client._socket)
const ip = client._socket.remoteAddress
const key = this.generateKey(context, ip)
const { totalHits } = await this.storageService.increment(key, ttl)

Loading…
Cancel
Save