gateway 需要独立部署 注意端口号的对应
(一) 注册中心地址的配置
TP框架方面:
\tp6\vendor\workerman\gatewayclient\Gateway
对应GATEWAY方面:
\Applications\Todpole\start_businessworker.php
Register text://127.0.0.1:1237
(二) 配置gateway进程
GATEWAY方面:
\Applications\Todpole\start_gateway.php
TodpoleGateway websocket://127.0.0.1:60803
HTML方面:
ws = new WebSocket('ws://127.0.0.1:60803');
wss配置 (小程序开发必须使用)
参考文档 : https://www.changliaokf.com/detail/servicecode/25.html
处理方式通过nginx代理wss
location /moz_wss
{
proxy_pass http://127.0.0.1:60803;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
添加进程守护避免服务器进程挂掉