Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 套接字io客户端包上的连接(请求)过多_Reactjs - Fatal编程技术网

Reactjs 套接字io客户端包上的连接(请求)过多

Reactjs 套接字io客户端包上的连接(请求)过多,reactjs,Reactjs,我使用“socket.io客户端”:“2.2.0”,即package.json上的socket io客户端版本 import io from "socket.io-client"; useEffect(() => { let socket = io(socketUrl()); //here goes the url socket.on('connect', () => { socket.emit('authentication',

我使用“socket.io客户端”:“2.2.0”,即package.json上的socket io客户端版本

import io from "socket.io-client";
useEffect(() => {
    let socket = io(socketUrl()); //here goes the url
    socket.on('connect', () => {
        socket.emit('authentication',
            {token: localStorage.getItem(`Bearer`), user_id: 0})

    });
    socket.on("connect_error", (err) => {
        console.log(`connect_error due to ${err.message}`);
    });
    socket.on('authenticated', (obj) => {
        socket.emit('start_marking', {token: localStorage.getItem(`Bearer`)});
    });
    socket.on('mark_payload', data => {
        //some functions to manipulate data....
    });
    socket.on('unauthorized', err =>
        console.log("There was an error with the authentication:", err.message));
},[])
这里的问题是什么,所以我得到了这些问题