Add debug code for mqtt sending #730
This commit is contained in:
parent
219ab513b5
commit
8e53a3bb19
1 changed files with 6 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ class MQTTClient
|
|||
|
||||
public function sendEvent(JobOrder $job_order, $payload)
|
||||
{
|
||||
error_log("CUSTOMER ID: " . $job_order->getCustomer()->getID());
|
||||
//error_log('sending mqtt event: ');
|
||||
//error_log(print_r($payload, true));
|
||||
|
||||
|
|
@ -44,16 +45,19 @@ class MQTTClient
|
|||
$new_sessions = [];
|
||||
$cust_user = $job_order->getCustomer()->getCustomerUser();
|
||||
if (!empty($cust_user)) {
|
||||
error_log("CUSTOMER USER ID: " . $cust_user->getID());
|
||||
$new_sessions = $cust_user->getMobileSessions();
|
||||
}
|
||||
|
||||
// TODO: make this more elegant. looping through each instead of merging the two because doctrine returns PersistentCollection if empty, and array if not
|
||||
$sessions = [];
|
||||
foreach ($legacy_sessions as $sess) {
|
||||
error_log("FOUND LEGACY SESSION: " . $sess->getID());
|
||||
$sessions[] = $sess;
|
||||
}
|
||||
|
||||
foreach ($new_sessions as $sess) {
|
||||
error_log("FOUND NEW SESSION: " . $sess->getID());
|
||||
$sessions[] = $sess;
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +75,8 @@ class MQTTClient
|
|||
$phone_num = $sess->getPhoneNumber();
|
||||
$channel = self::PREFIX . $phone_num;
|
||||
|
||||
error_log("SENDING TO CHANNEL: " . $channel);
|
||||
|
||||
// gather channels, so we only send once
|
||||
$channels[$channel] = json_encode($payload);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue