socket.io 没有连接 reactjs nodejs

问题描述 投票:0回答:0

服务器:

    const io = socketio(server, {
        cors: {
            origin: "https://melodybot.me",
            methods: ["GET", "POST"],
            credentials: true
        },
        transports: ['websocket', 'polling'],
        allowEIO3: true
    });```

client:

让 connectionOptions = { “强制新连接”:是的, "reconnectionAttempts": "无限", “超时”:10000, “传输”:[“websocket”,“轮询”], }; const ws = new io(url, connectionOptions);


in browser its saying connection failed

i want connect socket.io with reactjs and nodejs backeend i am usingg apche ubuntu
node.js reactjs express apache socket.io
© www.soinside.com 2019 - 2024. All rights reserved.