sails.sockets.join无效

时间:2016-04-18 12:34:43

标签: sockets sails.js

我将风帆从v0.10迁移到v0.11,我也按照迁移指南进行了操作,并执行了以下操作,

  1. sails生成sails.io.js --force。

  2. beforeConnect和afterConnect功能。

  3. 我面临以下问题,

    以下功能未执行,因此我无法将任何用户添加到房间

      sails.sockets.join(req, roomName, function(err) {
      /*code here*/
      });
    

    sockets.js中的beforeConnect函数根本没有调用。

    beforeConnect: function(handshake, cb) {
         // `true` allows the connection
         console.log("connected");
         return cb(null, true);
    
         // (`false` would reject the connection)
       },
    

0 个答案:

没有答案