Skip to content

Commit

Permalink
Merge pull request #18 from exodus4d/develop
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
exodus4d authored Mar 20, 2020
2 parents 58d0187 + 395c22a commit 54585b6
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 117 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## WebSocket server for [Pathfinder](https://github.com/exodus4d/pathfinder)

### Requirements
- _PHP_ **(≥ v7.1)**
- A working instance of *[Pathfinder](https://github.com/exodus4d/pathfinder)* **(≥ v1.2.0)**
- _PHP_ (≥ v7.1)
- A working instance of *[Pathfinder](https://github.com/exodus4d/pathfinder)* (≥ v2.0.0-rc.1)
- [_Composer_](https://getcomposer.org/download/) to install packages for the WebSocket server

### Install
1. Checkout this project in a **new** folder (NOT the install for _Pathfinder_ itself) e.g. `/var/www/websocket.pathfinder`
1. Checkout this project in a **new** folder e.g. `/var/www/websocket.pathfinder`
1. Install [_Composer_](https://getcomposer.org/download/)
2. Install Composer dependencies from `composer.json` file:
- `$ cd /var/www/websocket.pathfinder`
Expand Down
4 changes: 2 additions & 2 deletions app/Component/MapUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private function subscribe(ConnectionInterface $conn, array $subscribeData) : vo
sort($changedSubscriptionsMapIds, SORT_NUMERIC);

$this->log(['debug', 'info'], $conn, __FUNCTION__,
sprintf(static::LOG_TEXT_SUBSCRIBE, $characterId, implode($changedSubscriptionsMapIds, ','))
sprintf(static::LOG_TEXT_SUBSCRIBE, $characterId, implode(',', $changedSubscriptionsMapIds))
);

// broadcast all active subscriptions to subscribed connections -------------------------------------------
Expand Down Expand Up @@ -386,7 +386,7 @@ private function unSubscribeCharacterId(int $characterId, ?ConnectionInterface $
sort($changedSubscriptionsMapIds, SORT_NUMERIC);

$this->log(['debug', 'info'], $conn, __FUNCTION__,
sprintf(static::LOG_TEXT_UNSUBSCRIBE, $characterId, implode($changedSubscriptionsMapIds, ','))
sprintf(static::LOG_TEXT_UNSUBSCRIBE, $characterId, implode(',', $changedSubscriptionsMapIds))
);

// broadcast all active subscriptions to subscribed connections -------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions app/Log/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ private function echoLog(array $logData) : void {
$logData['remoteAddress'] . ($logData['resourceId'] ? ' #' . $logData['resourceId'] : ''),
self::$colors->getColoredString($logData['fileName'] . ' line ' . $logData['lineNumber'], 'dark_gray'),
self::$colors->getColoredString($logData['function'] . '()' . (($logData['function'] !== $logData['action']) ? ' [' . $logData['action'] . ']' : ''), 'dark_gray'),
implode((array)$logData['logTypes'], ','),
implode(',', (array)$logData['logTypes']),
self::$colors->getColoredString($logData['message'], 'light_purple')
];

echo implode(array_filter($data), ' | ') . PHP_EOL;
echo implode(' | ', array_filter($data)) . PHP_EOL;
}

/**
Expand Down
17 changes: 16 additions & 1 deletion cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,24 @@
}
$data[] = '';

echo implode($data, PHP_EOL) . PHP_EOL;
echo implode(PHP_EOL, $data) . PHP_EOL;
};

/**
* set error reporting based on debug option value
* @param int $debug
*/
$setErrorReporting = function(int $debug){
switch($debug){
case 0: error_reporting(0); break; // Turn off all error reporting
case 1: error_reporting(E_ERROR); break; // Errors only
case 2: error_reporting(E_ALL & ~E_NOTICE); break; // Report all errors except E_NOTICE
default: error_reporting(E_ALL);
}
};

$setErrorReporting($options['debug']);

if($options['debug']){
// print if -debug > 0
$showHelp($longOpts, $options);
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"php-64bit": ">=7.1",
"ext-json": "*",
"cboden/ratchet": "0.4.x",
"react/promise-stream": "1.1.*",
"clue/ndjson-react": "1.0.*"
"react/promise-stream": "1.2.*",
"clue/ndjson-react": "1.1.*"
},
"suggest": {
"ext-event": "If installed, 'ExtEventLoop' class will get used as default event loop. Better performance. https://pecl.php.net/package/event"
Expand Down
Loading

0 comments on commit 54585b6

Please sign in to comment.