Socket.io rooms difference between broadcast.to and sockets.in

前端 未结 5 2185
囚心锁ツ
囚心锁ツ 2020-12-02 05:43

Socket.io\'s readme contains the following example:

    var io = require(\'socket.io\').listen(80);

    io.sockets.on         


        
5条回答
  •  渐次进展
    2020-12-02 05:45

    In Socket.IO 1.0, .to() and .in() are the same. And others in the room will receive the message. The client sends it won't receive the message.

    Check out source code (v1.0.6):

    https://github.com/Automattic/socket.io/blob/a40068b5f328fe50a2cd1e54c681be792d89a595/lib/socket.js#L173

提交回复
热议问题