Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Adapter.prototype.broadcast = function(packet, opts){
* Gets a list of clients by sid.
*
* @param {Array} explicit set of rooms to check.
* @param {Function} callback
* @api public
*/

Expand Down Expand Up @@ -195,6 +196,18 @@ Adapter.prototype.clients = function(rooms, fn){
if (fn) process.nextTick(fn.bind(null, null, sids));
};

/**
* Gets the list of rooms a given client has joined.
*
* @param {String} socket id
* @param {Function} callback
* @api public
*/
Adapter.prototype.clientRooms = function(id, fn){
var rooms = this.sids[id];
if (fn) process.nextTick(fn.bind(null, null, rooms ? Object.keys(rooms) : null));
};

/**
* Room constructor.
*
Expand Down