Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
denzilferreira committed Dec 16, 2015
1 parent 2a6f6f2 commit 0ef65e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/controllers/webservice.php
Expand Up @@ -377,7 +377,7 @@ public function publish() {

// Using Mosquitto-PHP client that we installed over PECL
$client = new Mosquitto\Client("aware", false);
$client->setTlsCertificates($this->config->item("public_keys")."server.crt"); //load server SSL certificate
$client->setTlsCertificates($this->config->item("public_keys")."ca.crt"); //load server SSL certificate
$client->setTlsOptions(Mosquitto\Client::SSL_VERIFY_PEER, "tlsv1.2", NULL); //make sure peer has certificate
$client->setCredentials($mqtt_conf['mqtt_username'], $mqtt_conf['mqtt_password']); //load study-specific user credentials so we can connect
$client->connect($mqtt_conf['mqtt_server'], $mqtt_conf['mqtt_port']); //make connection
Expand All @@ -387,7 +387,7 @@ public function publish() {

// Loop through devices and send message
foreach ($devices as $device) {
$client->publish($topic['study_id'] . "/" . $device . "/" . $topic['type'], $msg, 2, true);
$client->publish($topic['study_id'] . "/" . $device . "/" . $topic['type'], $msg, 1, false);
}
//sleep(100);
//$client->disconnect();
Expand Down

0 comments on commit 0ef65e8

Please sign in to comment.