Socket.close/channel.close event fires after 30s of internet disconnection

Hi guys,
Whenever an internet disconnection happens, it takes an average of 30s to fire the channel.onClose and socket.onClose functions. Is there any way to configure this.

Basically i want the client to get notified of network disconnection, as soon as possible(5s average time taken). But right now it takes upto 30s to get notified.I am detecting this with socket’s onclose/onError and channel’s onClose/onError functions.

Thanks.

Are you using the websocket or long poll transport?

You can only find out if a connection is dead by trying to actually transmit on it and get a response. Phoenix does this once every 30 seconds, if you wanted it 5 you are going to increase your average packet amount by about 6 times, which is a lot more load. Are you sure you want to?

Websocket

Ok, basically this Phoenix server is a game server, so I have to notify and block input for players when the internet disconnects.

1 Like

Game servers are indeed one of those few rapid communicating ones! ^.^