开发者

Do we need a static IP to use HTML5 Websockets?

开发者 https://www.devze.com 2023-03-01 12:17 出处:网络
I am in the process of building a chat application in PHP using Web Sockets. I started with the code phpwebsocket projectand here. The code开发者_如何学Go works fine on my local machine but when i try

I am in the process of building a chat application in PHP using Web Sockets. I started with the code phpwebsocket project and here. The code开发者_如何学Go works fine on my local machine but when i try it on my site (does not have a dedicated IP) it has a problem establishing the web socket connection. I tried it with all possible combinations for socket binding (site addres, external ip addr, local ip addr) but failed.


You must be able to connect to the port on the server where the WebSocket server is running. If you are using a port other than 80 or 443 on your site for the WebSocket server, then you probably need to configure (or ask) the site to accept incoming connections on that port (because they may deny it by default for security reasons). It you are unable to telnet to the WebSocket port on the server, then this is likely the case (or phpwebsocket is not in fact correctly configured to list on that port).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号