Browse Source

fix protocol name

main
yggverse 7 months ago
parent
commit
46d1cb55ef
  1. 14
      README.md
  2. 4
      config/example.json
  3. 4
      src/Controller/Server/Nex.php
  4. 8
      src/server.php

14
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)) * [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 * [ ] `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] `src/server.php` - server launcher for different protocols:
* [x] [NEX Protocol](https://nightfall.city/nps/info/specification.txt) * [x] [NEX](https://nightfall.city/nex/info/specification.txt) - based on [Ratchet](https://github.com/ratchetphp/Ratchet) `IoServer` asynchronous socket library
* [ ] [Gemini Protocol](https://geminiprotocol.net) * [ ] [Gemini](https://geminiprotocol.net)
## Example ## Example
@ -29,7 +29,9 @@ RSS aggregator for different protocols
## Server ## Server
* `php src/server.php protocol=NPS config=name.json` - launch `NPS` server configured by `name.json` Launch as many servers as wanted by arguments
* `protocol` - supported options:
* `NPS` * `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 * `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)

4
config/example.json

@ -7,7 +7,7 @@
}, },
"server": "server":
{ {
"nps": "nex":
{ {
"host":"127.0.0.1", "host":"127.0.0.1",
"port":1900, "port":1900,
@ -18,7 +18,7 @@
"debug": "debug":
{ {
"enabled":true, "enabled":true,
"template":"[{time}] [init] NPS server at {host}:{port}" "template":"[{time}] [init] NEX protocol server at {host}:{port}"
} }
}, },
"open": "open":

4
src/Controller/Server/Nps.php → src/Controller/Server/Nex.php

@ -4,7 +4,7 @@ namespace Yggverse\Pulsar\Controller\Server;
use \Ratchet\MessageComponentInterface; use \Ratchet\MessageComponentInterface;
class Nps implements MessageComponentInterface class Nex implements MessageComponentInterface
{ {
private object $_config; private object $_config;
@ -15,7 +15,7 @@ class Nps implements MessageComponentInterface
\Yggverse\Pulsar\Model\Database $database \Yggverse\Pulsar\Model\Database $database
) { ) {
// Init config // Init config
$this->_config = $config->get()->server->nps; $this->_config = $config->get()->server->nex;
// Init database // Init database
$this->_database = $database; $this->_database = $database;

8
src/server.php

@ -26,15 +26,15 @@ $database = new \Yggverse\Pulsar\Model\Database(
// Start server // Start server
switch ($environment->get('protocol')) switch ($environment->get('protocol'))
{ {
case 'nps'|'NPS': case 'nex':
$server = \Ratchet\Server\IoServer::factory( $server = \Ratchet\Server\IoServer::factory(
new \Yggverse\Pulsar\Controller\Server\Nps( new \Yggverse\Pulsar\Controller\Server\Nex(
$config, $config,
$database $database
), ),
$config->get()->server->nps->port, $config->get()->server->nex->port,
$config->get()->server->nps->host $config->get()->server->nex->host
); );
$server->run(); $server->run();

Loading…
Cancel
Save