Skip to content

Instantly share code, notes, and snippets.

@yakuter
Created May 5, 2019 20:33
Embed
What would you like to do?
PHP and NATS.io Example
<?php
require_once 'vendor/autoload.php';
// Yeni bağlantı nesnesi oluşturma ve bağlanma
$client = new \Nats\Connection();
$client->connect();
// Subscriber
$callback = function($payload)
{
printf("Data: <strong>%s</strong>", $payload);
};
$sid = $client->subscribe("foo", $callback);
// Publisher
$client->publish('foo', 'Erhan Yakut');
// 1 mesaj gelene kadar bekletme
$client->wait(1);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment