aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-02-26 18:13:46 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-02-26 18:13:46 +0300
commitae9fd961750d739a8d05c70cbff747fd295b2632 (patch)
treeb492d4ab38d813da7fefd5d9ee3a143d09c8673c /README.md
parent3acf5bdba43bb7099a3990de03a8f429f7ff41e2 (diff)
README: improve example
Diffstat (limited to 'README.md')
-rw-r--r--README.md16
1 files changed, 10 insertions, 6 deletions
diff --git a/README.md b/README.md
index 80ab121..7f2379e 100644
--- a/README.md
+++ b/README.md
@@ -19,14 +19,18 @@ Here's a small example.
try {
$jobd = new jobd\Client(jobd\Client::MASTER_PORT, '127.0.0.1');
} catch (Exception $e) {
- die('Failed to connect.');
+ die("Failed to connect.\n");
}
-// poke master to send poll requests to workers
-$response = $jobd->poke(['target_name', 'another_name']);
-
-// get status from master
-$response = $status = $jobd->status();
+try {
+ // poke master to send poll requests to workers
+ $response = $jobd->poke(['target_name', 'another_name']);
+
+ // get status from master
+ $status = $jobd->status()->getData();
+} catch (Exception $e) {
+ die('jobd error: '.$e->getMessage()."\n");
+}
$jobd->close();
```