Anton Sarov
Anton Sarov

Reputation: 3748

Heroku WebSocket connection timeout

I have a Play Framework application, serving as a WebSocket server, running on Heroku and some WebSocket clients (chat-like application).

I noticed that Heroku closes each connection after 55 seconds of inactivity and I want to prevent this so I thought about creating a mechanism in my Play application that sends some kind of "ping" to each client in order to keep the connections alive.

I am just wondering if this is the way to go? Am I am missing something crucial here?

Best regards

Upvotes: 6

Views: 4972

Answers (1)

Prinzhorn
Prinzhorn

Reputation: 22508

I am just wondering if this is the way to go?

Yes. Here's what Heroku writes

The normal Heroku HTTP routing timeout rules apply to the WebSocket labs feature. Either client or server can prevent the connection from idling by sending an occasional ping packet over the connection.

https://devcenter.heroku.com/articles/heroku-labs-websockets#timeouts

Upvotes: 8

Related Questions