PHP code example of nesquick / trafficcophp
1. Go to this page and download the library: Download nesquick/trafficcophp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nesquick / trafficcophp example snippets
rafficCophp\Client;
$client = new Client('127.0.0.1', 3542);
$client->publish('channel_two', 'A little test message from php client example');
$client->subscribe('channel_one', 'channel_two', 'channel_three');
while (true) {
$client->receive(function($channel, $message) {
printf('Got message "%s" on %s', $message, $channel);
});
}