首页> 实战笔录 >软件配置 软件配置

index.html:505 WebSocket connection to 'ws://39.114.25.114:8282/' failed: Error in connection establ

作者:小萝卜 2020-05-31 浏览 1498

简介服务器换成linux服务器后,服务器端按守护进程运行了GatewayWork,但是用户端连接报错了index.html:505 WebSocket connection to 'ws://39.114.25.114:8282/' failed: Error in connection establ

服务器换成linux服务器后,服务器端按守护进程运行了GatewayWork,但是用户端连接报错了index.html:505 WebSocket connection to 'ws://39.114.25.114:8282/' failed: Error in connection establ

查看Gatewaywork运行状态:

[root@iZytv4bh882gfqZ GatewayWorker-for-win]# php start.php status
Workerman[start.php] status 
----------------------------------------------GLOBAL STATUS----------------------------------------------------
Workerman version:3.5.16          PHP version:7.0.33
start time:2020-05-31 14:14:25   run 0 days 0 hours   
load average: 0, 0, 0            event-loop:\Workerman\Events\Select
3 workers       9 processes
worker_name           exit_status      exit_count
YourAppBusinessWorker 0                0
YourAppGateway        0                0
Register              0                0
----------------------------------------------PROCESS STATUS---------------------------------------------------
pid	memory  listening                worker_name           connections send_fail timers  total_request qps    status
994	2M      none                     YourAppBusinessWorker 5           0         0       5             0      [idle]
997	2M      none                     YourAppBusinessWorker 5           0         0       5             0      [idle]
999	2M      none                     YourAppBusinessWorker 5           0         0       5             0      [idle]
1002	2M      none                     YourAppBusinessWorker 5           0         0       5             0      [idle]
1003	2M      websocket://0.0.0.0:8282 YourAppGateway        5           0         0       4             0      [idle]
1005	2M      websocket://0.0.0.0:8282 YourAppGateway        5           0         0       4             0      [idle]
1008	2M      websocket://0.0.0.0:8282 YourAppGateway        5           0         0       4             0      [idle]
1009	2M      websocket://0.0.0.0:8282 YourAppGateway        5           0         0       4             0      [idle]
1011	2M      text://0.0.0.0:1238      Register              8           0         0       8             0      [idle]
----------------------------------------------PROCESS STATUS---------------------------------------------------
Summary	18M     -                        -                     48          0         0       44            0      [Summary] 


问题原因:

服务器没有开启端口

解决办法:

开启服务器防火墙对应的端口

centos7

firewall-cmd --zone=public --add-port=8282/tcp --permanen
firewall-cmd --zone=public --add-port=1238/tcp --permanen
firewall-cmd --reload

centos6 或 安装了 iptables 的centos7

iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 8282 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 1238 -j ACCEPT
service iptables save
service iptables restart

如果用的是阿里云ecs服务器,记得在实例的安全组加入这两个端口

客户端连接ok,问题解决

很赞哦! (1)

文章评论

    高端网站建设