This method is deprecated. Please keep track of your rooms in app-level code.
Get the list of rooms a socket is subscribed to
Description | Accepted Data Types | Required ? | |
---|---|---|---|
1 | Socket | object |
Yes |
// Controller action
getMyRooms: function(req, res) {
var roomNames = JSON.stringify(sails.sockets.socketRooms(req.socket));
res.json({
message: 'I am subscribed to: '+roomNames
});
}
- The phrase "request socket" here refers to an application-layer WebSocket/Socket.io connection.
req.socket
also exists for HTTP requests, but it refers to the underlying TCP socket at the transport layer, which is different. Be sure and ensurereq.isSocket == true
before usingreq.socket
with this method.