📜  socket io 连接到命名空间 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:56.961000             🧑  作者: Mango

代码示例1
var io  = require('socket.io')(http, { path: '/myapp/socket.io'});

io
.of('/my-namespace')
.on('connection', function(socket){
    console.log('a user connected with id %s', socket.id);

    socket.on('my-message', function (data) {
        io.of('my-namespace').emit('my-message', data);
        // or socket.emit(...)
        console.log('broadcasting my-message', data);
    });
});