0

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.
Eric
  • 22,183
  • 20
  • 145
  • 196
  • Why don't you try logging a message at some given intervals, maybe that will keep it active. – Gautam Chettiar Oct 16 '22 at 05:35
  • @GautamChettiar What u propose is similar to ping/pong, that will work I guess. But I'm trying to figure out the rule of heroku's behavior on http/websocket connection. – Eric Oct 16 '22 at 05:38

0 Answers0