我有一个 Play Framework 应用程序,用作 WebSocket 服务器,在 Heroku 和一些 WebSocket 客户端(类似聊天的应用程序)上运行。
我注意到 Heroku 在 55 秒不活动后关闭每个连接,我想防止这种情况发生,所以我想在我的 Play 应用程序中创建一种机制,向每个客户端发送某种“ping”以保持连接处于事件状态。
我只是想知道这是否是要走的路?我在这里遗漏了一些重要的东西吗?
最好的祝福
最佳答案
I am just wondering if this is the way to go?
是的。这是 Heroku 写的
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
关于Heroku WebSocket 连接超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22847581/