Some log from heroku:
2022-10-16T05:19:03.088622+00:00 heroku[router]: at=error code=H15 desc="Idle connection" method=GET path="/api/v1/content/ws/RgPx8znal7AJb
2022-10-16T05:19:03.065493+00:00 app[web.1]: time="2022-10-16T05:19:03Z" level=info msg="error - on read: websocket: close 1006 (abnormal closure): unexpected EOF"
2022-10-16T05:20:57.758379+00:00 app[web.1]: time="2022-10-16T05:20:57Z" level=info msg="cleanup client, id = 'wscid-ee670cc5-4100-49d6-9857-8284d93a6d33'"
2022-10-16T05:20:57.758505+00:00 app[web.1]: time="2022-10-16T05:20:57Z" level=info msg="close msg received: &{418 close}"
Seems heroku will kill the websocket connection if there is no msg for a while.
Questions:
- If I want to keep the connection alive:
- Should I send ping/pong msg to keep the connection alive?
- Or, there are other ways to do that (e.g upgrade my account paid plan?) ?
BTW:
- If I deploy it on bare linux, the websocket connection never auto close.
- I do have
auto connect
from the client side, but that's even more expensive, and not good for user experience I think.
Update
- Seems heroku router will kill the idle connection after 55 seconds.