Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 0ebf223

Browse files
committed
Renamed the prop to replicator
1 parent 4389fd1 commit 0ebf223

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/HttpApi/Controllers/FetchChannelsController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
class FetchChannelsController extends Controller
1414
{
1515
/** @var ReplicationInterface */
16-
protected $pubsub;
16+
protected $replicator;
1717

18-
public function __construct(ChannelManager $channelManager, ReplicationInterface $pubsub)
18+
public function __construct(ChannelManager $channelManager, ReplicationInterface $replicator)
1919
{
2020
parent::__construct($channelManager);
2121

22-
$this->pubsub = $pubsub;
22+
$this->replicator = $replicator;
2323
}
2424

2525
public function __invoke(Request $request)
@@ -51,7 +51,7 @@ public function __invoke(Request $request)
5151

5252
// We ask the replication backend to get us the member count per channel.
5353
// We get $counts back as a key-value array of channel names and their member count.
54-
return $this->pubsub
54+
return $this->replicator
5555
->channelMemberCounts($request->appId, $channelNames)
5656
->then(function (array $counts) use ($channels, $attributes) {
5757
return [

src/WebSockets/Channels/Channel.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class Channel
1515
protected $channelName;
1616

1717
/** @var ReplicationInterface */
18-
protected $pubsub;
18+
protected $replicator;
1919

2020
/** @var \Ratchet\ConnectionInterface[] */
2121
protected $subscribedConnections = [];
2222

2323
public function __construct(string $channelName)
2424
{
2525
$this->channelName = $channelName;
26-
$this->pubsub = app(ReplicationInterface::class);
26+
$this->replicator = app(ReplicationInterface::class);
2727
}
2828

2929
public function getChannelName(): string
@@ -68,7 +68,7 @@ public function subscribe(ConnectionInterface $connection, stdClass $payload)
6868
$this->saveConnection($connection);
6969

7070
// Subscribe to broadcasted messages from the pub/sub backend
71-
$this->pubsub->subscribe($connection->app->id, $this->channelName);
71+
$this->replicator->subscribe($connection->app->id, $this->channelName);
7272

7373
$connection->send(json_encode([
7474
'event' => 'pusher_internal:subscription_succeeded',
@@ -81,7 +81,7 @@ public function unsubscribe(ConnectionInterface $connection)
8181
unset($this->subscribedConnections[$connection->socketId]);
8282

8383
// Unsubscribe from the pub/sub backend
84-
$this->pubsub->unsubscribe($connection->app->id, $this->channelName);
84+
$this->replicator->unsubscribe($connection->app->id, $this->channelName);
8585

8686
if (! $this->hasConnections()) {
8787
DashboardLogger::vacated($connection, $this->channelName);
@@ -120,7 +120,7 @@ public function broadcastToEveryoneExcept($payload, ?string $socketId, string $a
120120
// in this case. If this came from TriggerEventController, then we still want
121121
// to publish to get the message out to other server instances.
122122
if ($publish) {
123-
$this->pubsub->publish($appId, $this->channelName, $payload);
123+
$this->replicator->publish($appId, $this->channelName, $payload);
124124
}
125125

126126
// Performance optimization, if we don't have a socket ID,

src/WebSockets/Channels/PresenceChannel.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PresenceChannel extends Channel
2828
public function getUsers(string $appId)
2929
{
3030
// Get the members list from the replication backend
31-
return $this->pubsub
31+
return $this->replicator
3232
->channelMembers($appId, $this->channelName);
3333
}
3434

@@ -49,7 +49,7 @@ public function subscribe(ConnectionInterface $connection, stdClass $payload)
4949
$this->users[$connection->socketId] = $channelData;
5050

5151
// Add the connection as a member of the channel
52-
$this->pubsub
52+
$this->replicator
5353
->joinChannel(
5454
$connection->app->id,
5555
$this->channelName,
@@ -59,7 +59,7 @@ public function subscribe(ConnectionInterface $connection, stdClass $payload)
5959

6060
// We need to pull the channel data from the replication backend,
6161
// otherwise we won't be sending the full details of the channel
62-
$this->pubsub
62+
$this->replicator
6363
->channelMembers($connection->app->id, $this->channelName)
6464
->then(function ($users) use ($connection) {
6565
// Send the success event
@@ -86,7 +86,7 @@ public function unsubscribe(ConnectionInterface $connection)
8686
}
8787

8888
// Remove the connection as a member of the channel
89-
$this->pubsub
89+
$this->replicator
9090
->leaveChannel(
9191
$connection->app->id,
9292
$this->channelName,
@@ -110,7 +110,7 @@ public function unsubscribe(ConnectionInterface $connection)
110110
*/
111111
public function toArray(string $appId = null)
112112
{
113-
return $this->pubsub
113+
return $this->replicator
114114
->channelMembers($appId, $this->channelName)
115115
->then(function ($users) {
116116
return array_merge(parent::toArray(), [

0 commit comments

Comments
 (0)