Unsubscribe the requesting client socket from one or more database records.
Something.unsubscribe(req, ids);
| Argument | Type | Details | |
|---|---|---|---|
| 1 | req |
The incoming socket request (req) containing the socket to unsubscribe. |
|
| 2 | ids |
An array of record ids (primary key values). |
User.find({name: 'Lenny'}).exec(function(err, lennies) {
if (err) return res.serverError(err);
if (req.isSocket) {
User.unsubscribe( req, _.pluck(lennies, 'id') );
}
return res.ok();
});
- Be sure and check
req.isSocket === truebefore passing inreqto refer to the requesting socket. The providedreqmust be from a socket request, not just any old HTTP request.unsubscribewill only work when the request is made over a socket connection (e.g. usingio.socket.get()), not over HTTP (e.g. usingjQuery.get()).