Events stop to be listened after a while

Hello I have this piece of node.js app

const web3Rinkeby = new Web3(‘wss://’+process.env.INFURA_KEY);

const routerRinkeby = new web3Rinkeby.eth.Contract(
);{fromBlock: 0, step: 0}
.on(‘data’, async event => { … });

this works perfectly for a while, then it stops tu receive events.
I reboot the node.js server then it works again, then I wait for 1 hour without do anything with my contract, then I try again and the event is not triggered.
What’s the problem?

HI @Alessandro_Sbenaglia Welcome to the Infura community.
Idle connections that exceed an hour will get disconnected. Adding ‘pings’ to your WebSocket connection will prevent the connection from going idle. Any unrecognized requests will trigger the server to close the connection with an error message.