【发布时间】:2020-02-07 17:49:50
【问题描述】:
我有一个名为 https://www.example.com 的域(例如)
我开发的网站处于平均堆栈中。该站点正在http://localhost:3000端口上运行
我在管理端使用socket io,在客户端使用socket io客户端来实现实时数据共享功能。
// BACKEND
const server = http.createServer(app);
const io = require('socket.io')(server);
和
// FRONTEND
this.socket = io.connect();
我无法在前端和后端之间建立这种实时连接。
我尝试了很多解决方案,但无法得到答案?
我在前端尝试了下面的连接
this.socket = io.connect('wss://<ip-address>:3000', {
transports: ['websocket'],
});
但无法正常连接,提示超时错误
github 页面正在讨论相同的问题,但我没有从那里得到解决方案
【问题讨论】: