Unsubscribe all members of a room from one or more other rooms.
sails.sockets.removeRoomMembersFromRooms(sourceRoom, destRooms, cb);
Argument | Type | Details | |
---|---|---|---|
1 | sourceRoom |
The room to retrieve members from. | |
2 | destRooms |
The room or rooms to unsubscribe the members of sourceRoom from. |
|
3 | cb |
An optional callback which will be called when the operation is complete on the current server (see notes below for more information), or if fatal errors were encountered. In the case of errors, it will be called with a single argument (err ). |
In a controller action:
unsubscribeFunRoomMembersFromFunnerRooms: function(req, res) {
sails.sockets.removeRoomMembersFromRooms('funRoom', ['greatRoom', 'awesomeRoom'], function(err) {
if (err) {return res.serverError(err);}
res.json({
message: 'Unsubscribed all members of `funRoom` from `greatRoom` and `awesomeRoom`!'
});
});
}
- In a multi-server environment, the callback function (
cb
) will be executed when the.removeRoomMembersFromRooms()
call completes on the current server. This does not guarantee that other servers in the cluster have already finished running the operation.