diff --git a/README.md b/README.md index 39d0081..f516b77 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ RSS aggregator for different protocols * [x] `src/crawler.php` - scan configured RSS feeds and dump results to SQLite ([alternative branch](https://github.com/YGGverse/Pulsar/tree/fs)) * [ ] `src/cleaner.php` - auto clean deprecated records -* [x] `src/server.php` - server launcher with multiple host support, based on [Ratchet](https://github.com/ratchetphp/Ratchet) asynchronous socket library - * [x] [NEX Protocol](https://nightfall.city/nps/info/specification.txt) - * [ ] [Gemini Protocol](https://geminiprotocol.net) +* [x] `src/server.php` - server launcher for different protocols: + * [x] [NEX](https://nightfall.city/nex/info/specification.txt) - based on [Ratchet](https://github.com/ratchetphp/Ratchet) `IoServer` asynchronous socket library + * [ ] [Gemini](https://geminiprotocol.net) ## Example @@ -29,7 +29,9 @@ RSS aggregator for different protocols ## Server -* `php src/server.php protocol=NPS config=name.json` - launch `NPS` server configured by `name.json` - * `protocol` - supported options: - * `NPS` - * `config` - relative (to `config` folder) or absolute path to configuration file \ No newline at end of file +Launch as many servers as wanted by arguments + +* `php src/server.php protocol=nex config=name.json` - launch `nex` protocol server with `name.json` config + * `config` - relative (to `config` folder) or absolute path to configuration file + * `protocol` - server protocol, supported options: + * `nex` - [NEX Protocol](https://nightfall.city/nex/info/specification.txt) diff --git a/config/example.json b/config/example.json index f942f86..ba1fa01 100644 --- a/config/example.json +++ b/config/example.json @@ -7,7 +7,7 @@ }, "server": { - "nps": + "nex": { "host":"127.0.0.1", "port":1900, @@ -18,7 +18,7 @@ "debug": { "enabled":true, - "template":"[{time}] [init] NPS server at {host}:{port}" + "template":"[{time}] [init] NEX protocol server at {host}:{port}" } }, "open": diff --git a/src/Controller/Server/Nps.php b/src/Controller/Server/Nex.php similarity index 97% rename from src/Controller/Server/Nps.php rename to src/Controller/Server/Nex.php index 3da693c..4d8c288 100644 --- a/src/Controller/Server/Nps.php +++ b/src/Controller/Server/Nex.php @@ -4,7 +4,7 @@ namespace Yggverse\Pulsar\Controller\Server; use \Ratchet\MessageComponentInterface; -class Nps implements MessageComponentInterface +class Nex implements MessageComponentInterface { private object $_config; @@ -15,7 +15,7 @@ class Nps implements MessageComponentInterface \Yggverse\Pulsar\Model\Database $database ) { // Init config - $this->_config = $config->get()->server->nps; + $this->_config = $config->get()->server->nex; // Init database $this->_database = $database; diff --git a/src/server.php b/src/server.php index c8f3a7c..2f492bb 100644 --- a/src/server.php +++ b/src/server.php @@ -26,15 +26,15 @@ $database = new \Yggverse\Pulsar\Model\Database( // Start server switch ($environment->get('protocol')) { - case 'nps'|'NPS': + case 'nex': $server = \Ratchet\Server\IoServer::factory( - new \Yggverse\Pulsar\Controller\Server\Nps( + new \Yggverse\Pulsar\Controller\Server\Nex( $config, $database ), - $config->get()->server->nps->port, - $config->get()->server->nps->host + $config->get()->server->nex->port, + $config->get()->server->nex->host ); $server->run();