31 lines
722 B
PHP
Executable File
31 lines
722 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use NoccyLabs\Mercureact\Configuration;
|
|
use NoccyLabs\Mercureact\Daemon;
|
|
|
|
require_once __DIR__."/../vendor/autoload.php";
|
|
|
|
$opts = getopt("c:");
|
|
|
|
if (isset($opts['c'])) {
|
|
$config = Configuration::fromFile($opts['c']);
|
|
} else {
|
|
$config = Configuration::createDefault()
|
|
->addListener([
|
|
'address' => '127.0.0.1:8888',
|
|
'subscribe' => [
|
|
'anonymous' => true
|
|
]
|
|
])
|
|
->setAllowAnonymousSubscribe(true)
|
|
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
|
|
}
|
|
|
|
if (count($config->getListeners()) == 0) {
|
|
fwrite(STDERR, "No listeners available\n");
|
|
exit(1);
|
|
}
|
|
|
|
$daemon = new Daemon($config);
|
|
$daemon->start(); |