<?php namespace nats; include_once 'lib/NATSClient.php'; $client = new NATSClient(); $client->subscribe('nano', [], function ($message) { echo "{$message}"; }); $client->listen();
<?php namespace nats; include_once 'lib/NATSClient.php'; $client = new NATSClient(); $client->publish("nano", "Here forever!");
<?php namespace nats; include_once 'lib/NATSClient.php'; $client = new NATSClient(); $client->publish("nano", "Here forever!"); $client->subscribe("nano", [], function ($message, $reply, $sub) { echo "Received message:{$message}|{$reply}|{$sub}\n"; }); $client->listen();