Update the correct MQTT client with latest changes #783
This commit is contained in:
parent
a4b883b7ea
commit
d603934d93
2 changed files with 28 additions and 1 deletions
|
|
@ -89,6 +89,6 @@ class MQTTClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: this is for the new rider app
|
// NOTE: this is for the new rider app
|
||||||
$this->publish('rider/' . $rider->getID() . '/delivery', json_encode($payload));
|
$this->publish('rider/' . $rider->getID(), json_encode($payload));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,31 @@ class MQTTClientApiv2
|
||||||
// error_log('sent to ' . $channel);
|
// error_log('sent to ' . $channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendRiderEvent(JobOrder $job_order, $payload)
|
||||||
|
{
|
||||||
|
// check if a rider is available
|
||||||
|
$rider = $job_order->getRider();
|
||||||
|
if ($rider == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// NOTE: this is for the old rider app
|
||||||
|
// check if rider has sessions
|
||||||
|
$sessions = $rider->getSessions();
|
||||||
|
if (count($sessions) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// send to every rider session
|
||||||
|
foreach ($sessions as $sess)
|
||||||
|
{
|
||||||
|
$sess_id = $sess->getID();
|
||||||
|
$channel = self::RIDER_PREFIX . $sess_id;
|
||||||
|
$this->publish($channel, json_encode($payload));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: this is for the new rider app
|
||||||
|
$this->publish('rider/' . $rider->getID() . '/delivery', json_encode($payload));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue