PHP code example of facile-it / crossbar-http-publisher-bundle
1. Go to this page and download the library: Download facile-it/crossbar-http-publisher-bundle 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/ */
facile-it / crossbar-http-publisher-bundle example snippets
public function registerBundles()
{
return array(
// ...
new Facile\CrossbarHTTPPublisherBundle\FacileCrossbarHTTPPublisherBundle(),
);
}
$firstPublisher = $container->get('facile.crossbar.publisher.dummy_publisher_1');
$secondPublisher = $container->get('facile.crossbar.publisher.dummy_publisher_2');
$topic = 'com.myapp.topic1';
// using args
$firstPublisher->publish($topic, ['foo',1]);
// using kwargs
$secondPublisher->publish($topic, null, ['key'=>'value']);
// using both and printing Crossbar's response already decoded:
print_r($firstPublisher->publish($topic, ['foo',1], ['key'=>'value']));
// ouptuts:
//
// array(1) {
// ["id"]=>
// int(1395572605)
// }