@param int $fd
@param array $rooms

@return \SwooleTW\Http\Websocket\Rooms\TableRoom
192366
protected function setRooms(int $fd, array $rooms): TableRoom
    {
        return $this->setValue($fd, $rooms, RoomContract::DESCRIPTORS_KEY);
    }
1357577
public function dismiss($roomId, $optParams = array()) {
      $params = array('roomId' => $roomId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('dismiss', array($params));
      return $data;
    }
596316
protected function bindRoom(): void
    {
        $this->app->singleton(RoomContract::class, function (Container $container) {
            $config = $container->make('config');
            $driver = $config->get('swoole_websocket.default');
            $settings = $config->get("swoole_websocket.settings.{$driver}");
            $className = $config->get("swoole_websocket.drivers.{$driver}");

            // create room instance and initialize
            $room = $this->createRoom($className, $settings);
            $room->prepare();

            return $room;
        });

        $this->app->alias(RoomContract::class, 'swoole.room');
    }
516641
def rooms(&callback)
      http(:get, "/rooms.json") do |data, http|
        if data && data[:rooms]
          callback.call(data[:rooms].map{|room| Firering::Room.instantiate(self, room)}) if callback
        else
          logger.error(http.response)
          callback.call([])
        end
      end
    end
182337
public function delete(int $fd, $rooms)
    {
        $rooms = is_array($rooms) ? $rooms : [$rooms];
        $rooms = count($rooms) ? $rooms : $this->getRooms($fd);

        $this->removeValue($fd, $rooms, RoomContract::DESCRIPTORS_KEY);

        foreach ($rooms as $room) {
            $this->removeValue($room, [$fd], RoomContract::ROOMS_KEY);
        }
    }
610335
def _mkroom(self, room_id: str) -> Room:
        
        if room_id not in self.rooms:
            self.rooms[room_id] = Room(self, room_id)
        room = self.rooms[room_id]
        if not room.canonical_alias:
            room.update_aliases()
        return room
1255899
public function groupByActivity($result, $rooms, $classnames = []) {
    if (empty($result)) {
      return FALSE;
    }
    $date_keys = $formatted_result = [];

    // Create weekdays array.
    foreach ($result as $day => $data) {
      $date_keys[$day] = [];
    }
    $arr_date_keys = array_keys($date_keys);
    $first = reset($arr_date_keys);
    $last = end($arr_date_keys);
    $first = DrupalDateTime::createFromFormat('Y-m-d', $first)->format('F jS');
    $last = DrupalDateTime::createFromFormat('Y-m-d', $last)->format('F jS');
    $formatted_result['header'] = [
      'dates' => $first . ' - ' . $last,
    ];

    // Create activities array pass weekdays array to each.
    foreach ($result as $day => $data) {
      foreach ($data as $key => $session) {
        // Additionally filter by room.
        if (!empty($rooms) && !in_array($session->location . '||' . $session->room, $rooms)) {
          $location_found = FALSE;
          foreach ($rooms as $room) {
            // Keep locations with no selected rooms (means all are selected).
            if (strpos($room, $session->location) !== FALSE) {
              $location_found = TRUE;
            }
          }
          if ($location_found) {
            unset($result[$day][$key]);
            continue;
          }
        }
        if ($classnames && !in_array($session->name, $classnames)) {
          unset($result[$day][$key]);
          continue;
        }

        $formatted_result['content'][$session->location][$session->name] = [
          'room' => $session->room,
          'dates' => $date_keys
        ];
      }
    }
    foreach ($result as $day => $data) {
      foreach ($data as $session) {
        $formatted_result['content'][$session->location][$session->name]['dates'][$day][] = [
          'time' => $session->time_start . '-' . $session->time_end,
          'category' => $session->category,
        ];
      }
    }
    return $formatted_result;
  }
643480
public function online($buddy_ids, $room_ids, $show = null) {
        if(is_array($buddy_ids)) $buddy_ids = implode(',', $buddy_ids);
        if(is_array($room_ids)) $room_ids = implode(',', $room_ids);
        if( !$show ) $show = $this->endpoint->show;
        $endpoint = $this->endpoint;
        $status = isset($endpoint->status) ?  $endpoint->status : '';
		$data = array_merge($this->reqdata(), array(
			'rooms'=> $room_ids, 
			'buddies'=> $buddy_ids, 
			'name'=> $endpoint->id, 
			'nick'=> $endpoint->nick, 
			'status'=> $status, 
			'show' => $show
		));
		$response = $this->request('presences/online', $data, 'POST');
        $this->ticket = $response->ticket;
        $connection = array(
            "ticket" => $response->ticket,
            "domain" => $this->domain,
            "server" => $response->jsonpd,
            "jsonpd" => $response->jsonpd,
        );
        //if websocket 
        if(isset($response->websocket)) $connection['websocket'] = $response->websocket;
        //if mqttd
        if(isset($response->mqttd)) $connection['mqttd'] = $response->mqttd;
        return (object)array(
            "success" => true, 
            "connection" => (object)$connection,
            "presences" => $response->presences 
        );
	}
317824
public function add(int $fd, $roomNames)
    {
        $rooms = $this->getRooms($fd);
        $roomNames = is_array($roomNames) ? $roomNames : [$roomNames];

        foreach ($roomNames as $room) {
            $fds = $this->getClients($room);

            if (in_array($fd, $fds)) {
                continue;
            }

            $fds[] = $fd;
            $rooms[] = $room;

            $this->setClients($room, $fds);
        }

        $this->setRooms($fd, $rooms);
    }
320579
function buildRooms(baseRoom, dir, depth, attachments) {
        depth++;

        // group attachments
        attachments = _.chain(attachments)
            .clone()
            .concat(baseRoom.getMedia(false).map(file => path.join('media', path.relative(commonFolder, file))))
            .uniq()
            .value();

        baseRoom.items.forEach((room, i) => {
            let itemPath = path.join(dir, i.toString());
            fs.ensureDirSync(itemPath);

            if (!room.hasFiles) {
                buildRooms(room, itemPath, depth, attachments);
            } else {
                const roomsFiles = room.parsedFiles.map(file => {
                    file.destination = path.join(itemPath, 'files', file.parse.base);
                    file.content = fs.readFileSync(file.file, 'utf8');
                    file.mode = file.parse.ext.replace('.', '');
                    fs.copySync(file.file, file.destination);
                    return file;
                });

                // room attachments
                attachments = _.chain(attachments)
                    .clone()
                    .concat(room.getMedia(false).map(file => path.join('media', path.relative(commonFolder, file))))
                    .uniq()
                    .value();

                const css_paths = _.chain(attachments)
                    .concat(roomsFiles.map(file => path.relative(targetDir, file.destination)))
                    .filter(file => _.endsWith(file, '.css'))
                    .map(file => normalizePath(file, false))
                    .value();

                const js_paths = _.chain(attachments)
                    .concat(roomsFiles.map(file => path.relative(targetDir, file.destination)))
                    .filter(file => _.endsWith(file, '.js'))
                    .map(file => normalizePath(file, false))
                    .value();

                // iframe.html
                fs.writeFileSync(
                    path.join(itemPath, 'iframe.html'),
                    handlebars.compile(iframe)({
                        depth,
                        css_paths,
                        js_paths,
                        html: roomsFiles[0],
                    })
                );

                // index.html
                fs.writeFileSync(
                    path.join(itemPath, 'index.html'),
                    handlebars.compile(index)({
                        depth,
                        roomsFiles,
                        settings,
                        root,
                        room,
                        css_paths,
                        js_paths,
                        hasCSS: css_paths.length > 0,
                        hasJS: js_paths.length > 0,
                    })
                );
            }
        });
    }
1282850
public static function setFdToCoId(int $fd)
    {
        $cid = self::getCoroutineId();

        self::$map[$cid] = $fd;
    }
74830
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiRoom> List<T> getRoomList() {
	    List<Room> sfsRooms = getZone().getRoomList();
        List<T> answer = new ArrayList<>();
        for(Room sfsRoom : sfsRooms) {
            if(sfsRoom.containsProperty(APIKey.ROOM))
                answer.add((T) sfsRoom.getProperty(APIKey.ROOM));
        }
        return answer;
	}
685310
protected function isServerWebsocket(int $fd): bool
    {
        return (bool) $this->container->make(Server::class)
            ->connection_info($fd)['websocket_status'] ?? false;
    }
336118
protected function translateClassroomId($oldClassroomId)
    {
        $classroom = Classroom::where('name',ClassroomGroup::findOrFail($oldClassroomId)->name)->first();
        if ( $classroom != null ) {
            return $classroom->id;
        }
        throw new ClassroomNotFoundByNameException();
    }
172465
public function from($tables)
    {
        if (is_array($tables)) {
            $this->from = $tables;
        } else {
            $this->from = array($tables);
        }
        return $this;
    }
1304005
function thMultiple(array $cells) {
    foreach ($cells as $colName => $content) {
      $this->tsection->th($this->rowName, $colName, $content);
    }
    return $this;
  }
323398
public function getRoom($name)
    {
        $name = rawurlencode($name);

        if (!isset($this->rooms[$name])) {
            $this->rooms[$name] = new Room($this->getConnection(), $name);
        }

        return $this->rooms[$name];
    }