小程序与GatewayWorker建立连接及 apache 配置 https 转发

默然

1、apache 加载 proxy_module ,proxy_wstunnel_module 模块
2、apache 配置 ssl 

# Proxy Config
SSLProxyEngine on
#监听的路径和转发的路径,需要输入https:// 和最后面的/
ProxyRequests Off
ProxyPass /wss ws://0.0.0.0:8585
ProxyPassReverse /wss ws://0.0.0.0:8585

3、小程序代码

var that = this;
wx.connectSocket({
    url: "wss://www.xxx.com/wss"
});

4、GatewayWorker 代码

$gateway = new Gateway('websocket://0.0.0.0:8585', $context);
5768 2 0
2个评论

xiuwang

感谢分享

  • 暂无评论
大毛

小程序聊天项目 https://www.popoim.com

  • 暂无评论
年代过于久远,无法发表评论

默然

2005
积分
0
获赞数
0
粉丝数
2017-12-28 加入
🔝