Socket.io-client: 多个连接反应js

创建于 2020-12-02  ·  2评论  ·  资料来源: socketio/socket.io-client

你好
我有个问题 !!!

当io连接到服务器时,
服务器反复登录:
像这样:
新客户端已连接
客户端断开连接
新客户端已连接
客户端断开连接
客户端断开连接
新客户端已连接
客户端断开连接
新客户端已连接
新客户端已连接
客户端断开连接
客户端断开连接
新客户端已连接
新客户端已连接
客户端断开连接
新客户端已连接
客户端断开连接
新客户端已连接
客户端断开连接
新客户端已连接
客户端断开连接
客户端断开连接
新客户端已连接
客户端断开连接
新客户端已连接
新客户端已连接
客户端断开连接
客户端断开连接
客户端断开连接
客户端断开连接
客户端断开连接
客户端断开连接

服务器代码:
io.origins('*:*');
io.on('connection', (socket) => {
console.log('New client connected');
socket.on('disconnect', () => {
console.log('Client disconnected');
});
});

客户代码:
import io from 'socket.io-client';
const socket = io.connect('http://192.168.1.34:3000');

我的代码有什么问题???
请帮我

最有用的评论

安装插座。 [email protected]

所有2条评论

我也有这个问题

安装插座。 [email protected]

此页面是否有帮助?
0 / 5 - 0 等级