我在Lumen v5.6应用程序项目中实现了pusher。现在,我面临的问题是,如果有两个用户在场,并且每个用户都有自己的事件,但是当移动设备订阅了pusher事件,并且一段时间后,移动设备断开了与互联网的连接,但是当另一个用户/移动设备向该特定设备发送消息时/ user然后在一对一的频道列表中用户发现了哪个错误,因为设备没有取消订阅频道和事件的互联网。现在,还有另一种方法可以追踪当前的邮件接收用户是否可用,或者是否已与其事件关联。下面是我的工作代码
public function triggerPusher($trigger, $receiver, $loginUser, $isCallback = false) {
\Log::info("===== Trigger pusher ====");
\Log::info($trigger);
if (isset($trigger['data']['post'])) {
$trigger['data']['post'] = $this->removeIndexes($trigger['data']['post'], ['bucket', 'is_collage']);
}
$this->initPusher();
if ($sent_channel = $this->checkUserPresenceInChannel($trigger['channel'], $receiver)) {
\Log::info("=== Pusher send channel ===");
\Log::info($sent_channel);
\Log::info("=== Pusher Trigger Event ===");
\Log::info($trigger['event']);
$this->sentStatus = (strpos($sent_channel, 'presence-message-chat') !== false) ? "V" : "D";
// creating trigger data copy
// $chatData = $this->prepareChatData($trigger['data']);
return $this->pusher->trigger($sent_channel, $trigger['event'], array("data" => $trigger['data']), null, true);
}
\Log::info("=== Sent Via Push notification ===");
return $this->triggerNotification($trigger['data'], $receiver, $loginUser, $isCallback);
}
请提出任何有用的解决方案或参考链接。