Skip to content

bug: when we use cluster adapter on linux (client A send message to Client B with callback ) #4163

Closed
@introspection3

Description

@introspection3

Describe the bug
bug: when we use cluster adapter on linux (windows ok) (client A send Client B with callback ),will go wrong
at BroadcastOperator.emit (/opt/fastnat/index.js:162511:19)
at RemoteSocket.emit (/opt/fastnat/index.js:162604:30)
at /opt/fastnat/index.js:729:30
at processTicksAndRejections (node:internal/process/task_queues:96:5)
2021-11-09T21:36:53.490 ERROR default 3944986 :==> Error: Callbacks are not supported when broadcasting
at BroadcastOperator.emit (/opt/fastnat/index.js:162511:19)
at RemoteSocket.emit (/opt/fastnat/index.js:162604:30)
at /opt/fastnat/index.js:729:30
at processTicksAndRejections (node:in
To Reproduce

Please fill the following code example:

Socket.IO server version: x.y.z

"socket.io": "^4.1.3",
"socket.io-client": "^4.1.3",

on server

     socket.on(commandType.P2P_REQUEST_OPEN, async(data, fn) => {
        let targetClientId = data.targetClientId;
        let result = false;
        let info = '';
        let allSockets = await defaultNS.fetchSockets();
        let targetSocket = allSockets.find((value, index, array) => {
            return value.handshake.auth.clientId === targetClientId;
        });

        if (targetSocket != null) {
            result = true;
            logger.trace('start to notify targe socket to open p2p');
            //crash  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            targetSocket.emit(commandType.P2P_REQUEST_OPEN, data, (ret) => {
                fn(ret);
            });
        } else {
            info = `targetTunnelId's client is not online:targetClientId=` + targetClientId;
            fn({ success: result, data: data, info: info });
        }

    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions