feat: Add websocket limiter
MathurAditya724 opened this issue · comments
Aditya Mathur commented
- Add new limiter for web sockets
Discussed in #15
Originally posted by mathysth May 13, 2024
Hey i'm using hono rate limiter with redis and it work perfectly for me except for socket.
So I was wondering does this library support socket rate limiter ?
I have attached my socket to the server with the following but I can spam the route as I want without any restriction:
this.server.hono.get(
'/ws',
upgradeWebSocket(() => {
return {
onMessage: async (event, ws) => {
const response = await this.triggerEvent(event.data);
if (response || response === false) {
ws.send(JSON.stringify(response));
}
},
}
})
)
```</div>