sails.sockets.rooms()

Purpose

Get the list of all current socket rooms

Overview

Parameters

None.

Example Usage

  1. // Controller action
  2. getRoomsList: function(req, res) {
  3. var roomNames = JSON.stringify(sails.sockets.rooms());
  4. res.json({
  5. message: 'A list of all the rooms: '+roomNames
  6. });
  7. }

Note: In Socket.io, all sockets are automatically subscribed to a global room with an empty name (‘’). This room is not returned as part of the array in sails.sockets.rooms