/** * Update a resource * * @param array $data * @return Resource */ public function update($data = array()) { foreach ($data as $key => $value) { $this->{$key} = $value; } $postData = array(); foreach (static::$properties as $name) { $postData[$name] = $this->data[$name]; } $this->client->put(static::$path . '/' . $this->id(), $postData); return $this; }
<?php require_once "mqttclient.php"; $client = new MQTTClient("rob", "realtime.ngi.ibm.com", 1883); $client->connect(); $client->publish("robsmart", 0, "n", "test message 1"); $client->publish("robsmart", 0, "n", "test message 2"); $client->publish("robsmart", 0, "n", "test message 3"); $client->disconnect();