前言 微信小程序支持使用 WebSocket 连接到服务器,准确地说是带 SSL 的 WebSocket,而微信小程序中不允许使用带端口的 wss 连接,只能使用 443 端口.想使用其他端口就需要在服务器做一层代理,本文以 Ubuntu 16.04 服务器为例,使用 nginx 做 Web Server .本文参考了 如何在微信小程序的websocket上使用mqtt协议 ,在此感谢原作者. 步骤 安装 nginx 及配置的过程不再赘述,nginx 需要处理微信小程序 WebSocket 不支…