Skip to content

Commit

Permalink
add DefaultAdapter::clients #163
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor authored Aug 17, 2018
1 parent 1084f28 commit 820c4bd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/DefaultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ public function __construct($nsp)
$this->encoder = new Parser\Encoder();
Debug::debug('DefaultAdapter __construct');
}
public function __destruct()
{
Debug::debug('DefaultAdapter __destruct');
}

public function __destruct()
{
Debug::debug('DefaultAdapter __destruct');
}

public function add($id, $room)
{
$this->sids[$id][$room] = true;
Expand Down Expand Up @@ -92,5 +94,13 @@ public function broadcast($packet, $opts, $remote = false)
}
}
}

public function clients($rooms, $fn) {
$sids = array();
foreach ($rooms as $room) {
$sids = array_merge($sids, $this->rooms[$room]);
}
$fn();
}

}

0 comments on commit 820c4bd

Please sign in to comment.