2024-03-10 02:06:19 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
use NoccyLabs\Mercureact\Configuration;
|
|
|
|
use NoccyLabs\Mercureact\Daemon;
|
|
|
|
|
|
|
|
require_once __DIR__."/../vendor/autoload.php";
|
|
|
|
|
2024-03-11 01:15:04 +00:00
|
|
|
$opts = getopt("c:");
|
|
|
|
|
|
|
|
if (isset($opts['c'])) {
|
|
|
|
$config = Configuration::fromFile($opts['c']);
|
|
|
|
} else {
|
|
|
|
$config = Configuration::createDefault()
|
2024-03-11 21:12:01 +00:00
|
|
|
->addListener([
|
|
|
|
'address' => '127.0.0.1:8888',
|
|
|
|
'subscribe' => [
|
|
|
|
'anonymous' => true
|
|
|
|
]
|
|
|
|
])
|
2024-03-11 01:15:04 +00:00
|
|
|
->setAllowAnonymousSubscribe(true)
|
|
|
|
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
|
|
|
|
}
|
2024-03-10 02:06:19 +00:00
|
|
|
|
2024-03-11 21:12:01 +00:00
|
|
|
if (count($config->getListeners()) == 0) {
|
|
|
|
fwrite(STDERR, "No listeners available\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2024-03-10 02:06:19 +00:00
|
|
|
$daemon = new Daemon($config);
|
|
|
|
$daemon->start();
|