Answers for "how to use socket.io to send messages between just 2 people"

0

how to use socket.io to send messages between just 2 people

io.on('connection', socket => {
        socket.on('private message', (anotherSocketId, msg) => {
            socket.to(anotherSocketId).emit('private message', socket.id, msg);
        });
    });
Posted by: Guest on July-25-2021

Code answers related to "how to use socket.io to send messages between just 2 people"

Browse Popular Code Answers by Language