Timeout for Websocket connections

Hi!

I am writing to ask whether it is possible to set a timeout for WebSocket connections irrelevant if they are active or not. So, I am looking for something which is able to close any connections after an X amount of seconds/minutes.

Thanks in advance!