Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 2af9186

Browse files
committed
README file updated with req&res example
1 parent 57a5991 commit 2af9186

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ $callback = function($payload)
6868
};
6969
$client->subscribe("foo", $callback);
7070

71+
# Request
72+
$c->request('sayhello', 'Marty McFly', function ($response) {
73+
echo $response->getBody();
74+
});
75+
76+
# Responding to requests
77+
$sid = $c->subscribe("sayhello", function ($res) {
78+
$res->reply("Hello, " . $res->getBody() . " !!!");
79+
});
80+
81+
82+
7183
# Wait for 1 message
7284
$client->wait(1);
7385
```

src/Connection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ private function handlePING()
288288
* @param string $line Message command from NATS.
289289
*
290290
* @return \Exception|void
291+
* @codeCoverageIgnore
291292
*/
292293
private function handleMSG($line)
293294
{

0 commit comments

Comments
 (0)