<div>Hello,<br></div><div><br></div><div>When using Cowboy Websockets, I am seeing strange behavior during a timeout.<br></div><div><br></div><div>As per the documentation, when upgrading a connection to websocket, there is an optional parameter for idle_timeout (defaults to 60000).  This works, and the connection does close after the correct number of seconds.<br></div><div><br></div><div>However, there is no timeout message sent to the client, and I don't see a way to send one.<br></div><div><br></div><div>There is a websocket_terminate/3 callback.  However, the documentation seems to indicate that function is called *after* the connection is closed.<br></div><div><br></div><div>Looking in the source code for cowboy_websocket.erl, I see on lines 417-429 the different ways to close the socket.  A "stop" and a "timeout" are handled exactly the same, with a generic close of 1000.  So, no way for the client to know that idle_timeout was triggered.<br></div><div><br></div><div>We have a service that streams data to a browser client.<br></div><div>- The browser connects and requests a subscriptions to a feed<br></div><div>- We then stream that data continuously.<br></div><div>- No further action is required from the client, except a ping to keep the connection open.<br></div><div><br></div><div>However, if the client doesn't ping, the connection will close silently.  There is no indication to the client that they were dropped due to timeout.<br></div><div><br></div><div>Is there a way to remedy this?  Perhaps some way to have Cowboy send a "timeout message" when idle_timeout triggers?<br></div><div><br></div><div>Thank You,<br></div><div><br></div><div><br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user"><div>--<br></div><div>Noah <br></div></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div>