[英]does socket.io serving websockets need to physically be on port 80?
using node.js
and socket.io
to serve websockets
使用
node.js
和socket.io
来提供websockets
does socket.io
need to be listening on port 80 - the real port for websockets
, or can it be proxied to a different port, eg, port 8011, on the server? socket.io
需要监听端口80 - websockets
的真实端口,还是可以代理到服务器上的不同端口,例如端口8011?
the browser, using websockets
, talks through 80/http. 浏览器,使用
websockets
,通过80 / http进行websockets
。 on the server haproxy
redirects websockets
to node.js
. 在服务器
haproxy
重定向websockets
到node.js
。
right haproxy
directs to 127.0.4.11:80
. 右
haproxy
指向127.0.4.11:80
。 this works fine, but this requires sudo
to run node.js
. 这工作正常,但这需要
sudo
来运行node.js
would rather redirect to localhost:8011
, but do not know if socket.io
needs to actually be on port 80 to support websockets
correctly. 宁愿重定向到
localhost:8011
,但不知道socket.io
需要实际上在端口80上才能正确支持websockets
。
WebSockets (and Socket.IO) can run on any port; WebSockets(和Socket.IO)可以在任何端口上运行; most developers will develop their servers on a high-numbered port specifically to avoid running as root in development.
大多数开发人员将在高编号端口上开发他们的服务器,以避免在开发中以root身份运行。 Furthermore, the Socket.IO wiki has a page on ports and which ones work for various firewall software .
此外,Socket.IO wiki有一个端口页面,哪些适用于各种防火墙软件 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.