The rate limiting and connection checks are performed inside the connection event handler. This means a WebSocket connection is already established before the checks are done.
We should use the verifyClient option of the WebSocketServer. This allows us to inspect the request and reject it before the WebSocket handshake is completed, saving server resources.
The rate limiting and connection checks are performed inside the
connectionevent handler. This means a WebSocket connection is already established before the checks are done.We should use the verifyClient option of the WebSocketServer. This allows us to inspect the request and reject it before the WebSocket handshake is completed, saving server resources.