@@ -104,12 +104,13 @@ public function publish(string $appId, string $channel, stdClass $payload): bool
104104
105105 $ payload = json_encode ($ payload );
106106
107- $ this ->publishClient ->__call ('publish ' , ["$ appId: $ channel " , $ payload ]);
107+ $ this ->publishClient ->__call ('publish ' , ["{ $ appId} : { $ channel} " , $ payload ]);
108108
109109 DashboardLogger::log ($ appId , DashboardLogger::TYPE_REPLICATOR_MESSAGE_PUBLISHED , [
110110 'channel ' => $ channel ,
111111 'serverId ' => $ this ->getServerId (),
112112 'payload ' => $ payload ,
113+ 'pubsub ' => "{$ appId }: {$ channel }" ,
113114 ]);
114115
115116 return true ;
@@ -124,18 +125,19 @@ public function publish(string $appId, string $channel, stdClass $payload): bool
124125 */
125126 public function subscribe (string $ appId , string $ channel ): bool
126127 {
127- if (! isset ($ this ->subscribedChannels ["$ appId: $ channel " ])) {
128+ if (! isset ($ this ->subscribedChannels ["{ $ appId} : { $ channel} " ])) {
128129 // We're not subscribed to the channel yet, subscribe and set the count to 1
129- $ this ->subscribeClient ->__call ('subscribe ' , ["$ appId: $ channel " ]);
130- $ this ->subscribedChannels ["$ appId: $ channel " ] = 1 ;
130+ $ this ->subscribeClient ->__call ('subscribe ' , ["{ $ appId} : { $ channel} " ]);
131+ $ this ->subscribedChannels ["{ $ appId} : { $ channel} " ] = 1 ;
131132 } else {
132133 // Increment the subscribe count if we've already subscribed
133- $ this ->subscribedChannels ["$ appId: $ channel " ]++;
134+ $ this ->subscribedChannels ["{ $ appId} : { $ channel} " ]++;
134135 }
135136
136137 DashboardLogger::log ($ appId , DashboardLogger::TYPE_REPLICATOR_SUBSCRIBED , [
137138 'channel ' => $ channel ,
138139 'serverId ' => $ this ->getServerId (),
140+ 'pubsub ' => "{$ appId }: {$ channel }" ,
139141 ]);
140142
141143 return true ;
@@ -150,23 +152,24 @@ public function subscribe(string $appId, string $channel): bool
150152 */
151153 public function unsubscribe (string $ appId , string $ channel ): bool
152154 {
153- if (! isset ($ this ->subscribedChannels ["$ appId: $ channel " ])) {
155+ if (! isset ($ this ->subscribedChannels ["{ $ appId} : { $ channel} " ])) {
154156 return false ;
155157 }
156158
157159 // Decrement the subscription count for this channel
158- $ this ->subscribedChannels ["$ appId: $ channel " ]--;
160+ $ this ->subscribedChannels ["{ $ appId} : { $ channel} " ]--;
159161
160162 // If we no longer have subscriptions to that channel, unsubscribe
161- if ($ this ->subscribedChannels ["$ appId: $ channel " ] < 1 ) {
162- $ this ->subscribeClient ->__call ('unsubscribe ' , ["$ appId: $ channel " ]);
163+ if ($ this ->subscribedChannels ["{ $ appId} : { $ channel} " ] < 1 ) {
164+ $ this ->subscribeClient ->__call ('unsubscribe ' , ["{ $ appId} : { $ channel} " ]);
163165
164- unset($ this ->subscribedChannels ["$ appId: $ channel " ]);
166+ unset($ this ->subscribedChannels ["{ $ appId} : { $ channel} " ]);
165167 }
166168
167169 DashboardLogger::log ($ appId , DashboardLogger::TYPE_REPLICATOR_UNSUBSCRIBED , [
168170 'channel ' => $ channel ,
169171 'serverId ' => $ this ->getServerId (),
172+ 'pubsub ' => "{$ appId }: {$ channel }" ,
170173 ]);
171174
172175 return true ;
@@ -184,13 +187,14 @@ public function unsubscribe(string $appId, string $channel): bool
184187 */
185188 public function joinChannel (string $ appId , string $ channel , string $ socketId , string $ data )
186189 {
187- $ this ->publishClient ->__call ('hset ' , ["$ appId: $ channel " , $ socketId , $ data ]);
190+ $ this ->publishClient ->__call ('hset ' , ["{ $ appId} : { $ channel} " , $ socketId , $ data ]);
188191
189192 DashboardLogger::log ($ appId , DashboardLogger::TYPE_REPLICATOR_JOINED_CHANNEL , [
190193 'channel ' => $ channel ,
191194 'serverId ' => $ this ->getServerId (),
192195 'socketId ' => $ socketId ,
193196 'data ' => $ data ,
197+ 'pubsub ' => "{$ appId }: {$ channel }" ,
194198 ]);
195199 }
196200
@@ -205,12 +209,13 @@ public function joinChannel(string $appId, string $channel, string $socketId, st
205209 */
206210 public function leaveChannel (string $ appId , string $ channel , string $ socketId )
207211 {
208- $ this ->publishClient ->__call ('hdel ' , ["$ appId: $ channel " , $ socketId ]);
212+ $ this ->publishClient ->__call ('hdel ' , ["{ $ appId} : { $ channel} " , $ socketId ]);
209213
210214 DashboardLogger::log ($ appId , DashboardLogger::TYPE_REPLICATOR_LEFT_CHANNEL , [
211215 'channel ' => $ channel ,
212216 'serverId ' => $ this ->getServerId (),
213217 'socketId ' => $ socketId ,
218+ 'pubsub ' => "{$ appId }: {$ channel }" ,
214219 ]);
215220 }
216221
@@ -223,7 +228,7 @@ public function leaveChannel(string $appId, string $channel, string $socketId)
223228 */
224229 public function channelMembers (string $ appId , string $ channel ): PromiseInterface
225230 {
226- return $ this ->publishClient ->__call ('hgetall ' , ["$ appId: $ channel " ])
231+ return $ this ->publishClient ->__call ('hgetall ' , ["{ $ appId} : { $ channel} " ])
227232 ->then (function ($ members ) {
228233 // The data is expected as objects, so we need to JSON decode
229234 return array_map (function ($ user ) {
@@ -244,7 +249,7 @@ public function channelMemberCounts(string $appId, array $channelNames): Promise
244249 $ this ->publishClient ->__call ('multi ' , []);
245250
246251 foreach ($ channelNames as $ channel ) {
247- $ this ->publishClient ->__call ('hlen ' , ["$ appId: $ channel " ]);
252+ $ this ->publishClient ->__call ('hlen ' , ["{ $ appId} : { $ channel} " ]);
248253 }
249254
250255 return $ this ->publishClient ->__call ('exec ' , [])
0 commit comments