Created
May 5, 2019 20:33
-
-
Save yakuter/2a262b2db86b1bd6a15821345b923810 to your computer and use it in GitHub Desktop.
PHP and NATS.io Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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