Download the PHP package exodus4d/pathfinder_websocket without Composer
On this page you can find all versions of the php package exodus4d/pathfinder_websocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download exodus4d/pathfinder_websocket
More information about exodus4d/pathfinder_websocket
Files in exodus4d/pathfinder_websocket
Package pathfinder_websocket
Short Description WebSocket extension for 'Pathfinder'
License MIT
Informations about the package pathfinder_websocket
WebSocket server for Pathfinder
Requirements
- PHP (≥ v7.1)
- A working instance of Pathfinder (≥ v2.0.0-rc.1)
- Composer to install packages for the WebSocket server
Install
- Checkout this project in a new folder e.g.
/var/www/websocket.pathfinder
- Install Composer
- Install Composer dependencies from
composer.json
file:$ cd /var/www/websocket.pathfinder
$ composer install
- Start WebSocket server
$ php cmd.php
Configuration
Default
Clients (WebBrowser) listen for connections
- Host:
0.0.0.0.
(=> any client can connect) - Port:
8020
- ↪ URI:
127.0.0.1:8020
(=> Your WebServer (e.g. Nginx) should proxy all WebSocket connections to this source)
TCP TcpSocket connection (Internal use for WebServer ⇄ WebSocket server communication)
- Host:
127.0.0.1
(=> Assumed WebServer and WebSocket server running on the same machine) - Port:
5555
- ↪ URI:
tcp://127.0.0.1:5555
(=> Where Pathfinder reaches the WebSocket server. This must match SOCKET_HOST
, SOCKET_PORT
options in environment.ini
)
Start parameters [Optional]
The default configuration should be fine for most installations. You can change/overwrite the default Host and Port configuration by adding additional CLI parameters when starting the WebSocket server:
$ php cmd.php --wsHost [CLIENTS_HOST] --wsPort [CLIENTS_PORT] --tcpHost [TCP_HOST] --tcpPort [TCP_PORT] --debug 0
For example: If you want to change the the WebSocket port and increase debug output:
$ php cmd.php --wsPort 8030 --debug 3
--debug (default --debug 2
)
Allows you to set log output level from 0
(silent) - errors are not logged, to 3
(debug) for detailed logging.
WebSocket UI
There is a WebSocket section on Pathinders /setup
page. After the WebSocket server is started, you should check it if everything works.
You see the most recent WebSocket log entries, the current connection state, the current number of active connections and all maps that have subscriptions
Log entry view. Depending on the --debug
parameter, the most recent (max 50) entries will be shown:
Subscriptions for each map:
Unix Service (systemd)
New Service
It is recommended to wrap the cmd.php
script in a Unix service, that over control the WebSocket server.
This creates a systemd service on CentOS7:
$ cd /etc/systemd/system
$ vi websocket.pathfinder.service
- Copy script and adjust
ExecStart
andWorkingDirectory
values:
Now you can use the service to start/stop/restart your WebSocket server
$ systemctl start websocket.pathfinder.service
$ systemctl restart websocket.pathfinder.service
$ systemctl stop websocket.pathfinder.service
Auto-Restart the Service
You can automatically restart your service (e.g. on EVE-Online downtime). Create a new "timer" for the automatic restart.
$ cd /etc/systemd/system
(same dir as before)$ vi restart.websocket.pathfinder.timer
- Copy script:
Now we need a new "restart service" for the timer:
$ cd /etc/systemd/system
(same dir as before)$ vi restart.websocket.pathfinder.service
- Copy script:
And then, we need to either restart the machine or launch
Info
All versions of pathfinder_websocket with dependencies
ext-json Version *
cboden/ratchet Version 0.4.x
react/promise-stream Version 1.2.*
clue/ndjson-react Version 1.1.*