有没有办法在Heroku中使用PHP WebSocket ?,它似乎默认只支持其他技术 [英] Is there a way to use PHP WebSocket in Heroku?, it seems by default there's only support for other technologies

查看:96
本文介绍了有没有办法在Heroku中使用PHP WebSocket ?,它似乎默认只支持其他技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个聊天室应用程序,我在本地进行了测试,并且可以正常运行,但是当我将它部署到heroku时,出现了CONNECTION REFUSE ERROR,我看到了heroku现在支持WebSocket,但它似乎只适用于所有支持的技术但PHP。

I've made a chat room app, I tested locally and it works, but when I deploy it to heroku, there's a CONNECTION REFUSE ERROR, I saw that heroku now support WebSocket, but it seems it's only for all supported technologies but PHP.

推荐答案

是的,您可以在Heroku中使用WebSocket。一般来说,PHP是一种非常困难的语言,并且我会推荐一种不同的语言。但不管我怎么想,你都可以随心所欲。如果您使用的是Heroku,则必须遵循闲置的标准规则。如果一个程序提醒闲置55秒,程序将被终止。处理这种情况的方法是每30秒发送一次来自服务器的ping消息。

Yes you can use WebSocket in Heroku. PHP is a very difficult language in general when it comes to WebSockets and I would recommend a different one. But regardless of what I think, you may do as you please. If you are using Heroku, you have to follow the standard rules of idle. If a program reminds idle for 55 seconds the program will be terminated. The way to handle this would be to send a ping message from the server every 30ish seconds.

https://devcenter.heroku.com/articles/websockets

这篇关于有没有办法在Heroku中使用PHP WebSocket ?,它似乎默认只支持其他技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆