Renamed the prop to replicator
This commit is contained in:
parent
4389fd1360
commit
0ebf223584
|
|
@ -13,13 +13,13 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
|||
class FetchChannelsController extends Controller
|
||||
{
|
||||
/** @var ReplicationInterface */
|
||||
protected $pubsub;
|
||||
protected $replicator;
|
||||
|
||||
public function __construct(ChannelManager $channelManager, ReplicationInterface $pubsub)
|
||||
public function __construct(ChannelManager $channelManager, ReplicationInterface $replicator)
|
||||
{
|
||||
parent::__construct($channelManager);
|
||||
|
||||
$this->pubsub = $pubsub;
|
||||
$this->replicator = $replicator;
|
||||
}
|
||||
|
||||
public function __invoke(Request $request)
|
||||
|
|
@ -51,7 +51,7 @@ class FetchChannelsController extends Controller
|
|||
|
||||
// We ask the replication backend to get us the member count per channel.
|
||||
// We get $counts back as a key-value array of channel names and their member count.
|
||||
return $this->pubsub
|
||||
return $this->replicator
|
||||
->channelMemberCounts($request->appId, $channelNames)
|
||||
->then(function (array $counts) use ($channels, $attributes) {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Channel
|
|||
protected $channelName;
|
||||
|
||||
/** @var ReplicationInterface */
|
||||
protected $pubsub;
|
||||
protected $replicator;
|
||||
|
||||
/** @var \Ratchet\ConnectionInterface[] */
|
||||
protected $subscribedConnections = [];
|
||||
|
|
@ -23,7 +23,7 @@ class Channel
|
|||
public function __construct(string $channelName)
|
||||
{
|
||||
$this->channelName = $channelName;
|
||||
$this->pubsub = app(ReplicationInterface::class);
|
||||
$this->replicator = app(ReplicationInterface::class);
|
||||
}
|
||||
|
||||
public function getChannelName(): string
|
||||
|
|
@ -68,7 +68,7 @@ class Channel
|
|||
$this->saveConnection($connection);
|
||||
|
||||
// Subscribe to broadcasted messages from the pub/sub backend
|
||||
$this->pubsub->subscribe($connection->app->id, $this->channelName);
|
||||
$this->replicator->subscribe($connection->app->id, $this->channelName);
|
||||
|
||||
$connection->send(json_encode([
|
||||
'event' => 'pusher_internal:subscription_succeeded',
|
||||
|
|
@ -81,7 +81,7 @@ class Channel
|
|||
unset($this->subscribedConnections[$connection->socketId]);
|
||||
|
||||
// Unsubscribe from the pub/sub backend
|
||||
$this->pubsub->unsubscribe($connection->app->id, $this->channelName);
|
||||
$this->replicator->unsubscribe($connection->app->id, $this->channelName);
|
||||
|
||||
if (! $this->hasConnections()) {
|
||||
DashboardLogger::vacated($connection, $this->channelName);
|
||||
|
|
@ -120,7 +120,7 @@ class Channel
|
|||
// in this case. If this came from TriggerEventController, then we still want
|
||||
// to publish to get the message out to other server instances.
|
||||
if ($publish) {
|
||||
$this->pubsub->publish($appId, $this->channelName, $payload);
|
||||
$this->replicator->publish($appId, $this->channelName, $payload);
|
||||
}
|
||||
|
||||
// Performance optimization, if we don't have a socket ID,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class PresenceChannel extends Channel
|
|||
public function getUsers(string $appId)
|
||||
{
|
||||
// Get the members list from the replication backend
|
||||
return $this->pubsub
|
||||
return $this->replicator
|
||||
->channelMembers($appId, $this->channelName);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class PresenceChannel extends Channel
|
|||
$this->users[$connection->socketId] = $channelData;
|
||||
|
||||
// Add the connection as a member of the channel
|
||||
$this->pubsub
|
||||
$this->replicator
|
||||
->joinChannel(
|
||||
$connection->app->id,
|
||||
$this->channelName,
|
||||
|
|
@ -59,7 +59,7 @@ class PresenceChannel extends Channel
|
|||
|
||||
// We need to pull the channel data from the replication backend,
|
||||
// otherwise we won't be sending the full details of the channel
|
||||
$this->pubsub
|
||||
$this->replicator
|
||||
->channelMembers($connection->app->id, $this->channelName)
|
||||
->then(function ($users) use ($connection) {
|
||||
// Send the success event
|
||||
|
|
@ -86,7 +86,7 @@ class PresenceChannel extends Channel
|
|||
}
|
||||
|
||||
// Remove the connection as a member of the channel
|
||||
$this->pubsub
|
||||
$this->replicator
|
||||
->leaveChannel(
|
||||
$connection->app->id,
|
||||
$this->channelName,
|
||||
|
|
@ -110,7 +110,7 @@ class PresenceChannel extends Channel
|
|||
*/
|
||||
public function toArray(string $appId = null)
|
||||
{
|
||||
return $this->pubsub
|
||||
return $this->replicator
|
||||
->channelMembers($appId, $this->channelName)
|
||||
->then(function ($users) {
|
||||
return array_merge(parent::toArray(), [
|
||||
|
|
|
|||
Loading…
Reference in New Issue