packages/teraslice/lib/cluster/services/cluster/backends/native/messaging.js
function _attachRoomsSocketIO() {
        if (!io) return;

        // middleware
        io.use((socket, next) => {
            const {
                node_id: nodeId,
            } = socket.handshake.query;

            if (nodeId) {
                logger.info(`node ${nodeId} joining room on connect`);
                socket.join(nodeId);
            }

            return next();
        });
    }
function _attachRoomsSocketIO() {
        if (!io) return;

        // middleware
        io.use((socket, next) => {
            const {
                node_id: nodeId,
            } = socket.handshake.query;

            if (nodeId) {
                logger.info(`node ${nodeId} joining room on connect`);
                socket.join(nodeId);
            }

            return next();
        });
    }
function _attachRoomsSocketIO ( ) { if ( ! io ) return ; // middleware io . use ( ( socket , next ) => { const { node_id : nodeId , } = socket . handshake . query ; if ( nodeId ) { logger . info ( ` ${ nodeId } ` ) ; socket . join ( nodeId ) ; } return next ( ) ; } ) ; }
join rooms before on connect to avoid race conditions
join rooms before on connect to avoid race conditions