- remove all PHP "_ZMQ_" related dependencies from Pathfinder. PHP´s native Sockets work as replacement

- added status information for "WebSocket" installations to `/setup` page (e.g. active connections, startup time)
- removed "ext-zmq" as required PHP extension
- removed "react/zmq" as required Composer package
- removed "websoftwares/monolog-zmq-handler" as required Composer package
This commit is contained in:
Mark Friedrich
2019-02-24 22:24:54 +01:00
parent 1d1e0ec213
commit a154fe80e8
23 changed files with 481 additions and 485 deletions

View File

@@ -639,10 +639,8 @@ class Map extends Controller\AccessController {
* -> if characters with map access found -> broadcast mapData to them
* @param Model\MapModel $map
* @throws Exception
* @throws \ZMQSocketException
*/
protected function broadcastMapAccess(Model\MapModel $map){
$mapAccess = [
'id' => $map->_id,
'characterIds' => array_map(function ($data){
@@ -650,7 +648,7 @@ class Map extends Controller\AccessController {
}, $map->getCharactersData())
];
(new Socket( Config::getSocketUri() ))->sendData('mapAccess', $mapAccess);
$this->getF3()->webSocket()->write('mapAccess', $mapAccess);
// map has (probably) active connections that should receive map Data
$this->broadcastMapData($map);
@@ -659,11 +657,9 @@ class Map extends Controller\AccessController {
/**
* broadcast map delete information to clients
* @param int $mapId
* @return bool|string
* @throws \ZMQSocketException
*/
protected function broadcastMapDeleted($mapId){
return (new Socket( Config::getSocketUri() ))->sendData('mapDeleted', $mapId);
protected function broadcastMapDeleted(int $mapId){
$this->getF3()->webSocket()->write('mapDeleted', $mapId);
}
/**
@@ -702,7 +698,15 @@ class Map extends Controller\AccessController {
// send Access Data to WebSocket Server and get response (status)
// if 'OK' -> Socket exists
$return->status = (new Socket( Config::getSocketUri() ))->sendData('mapConnectionAccess', $return->data);
$status = '';
$f3->webSocket()
->write('mapConnectionAccess', $return->data)
->then(
function($payload) use (&$status) {
$status = (string)$payload['load'];
});
$return->status = $status;
echo json_encode( $return );
}

View File

@@ -17,7 +17,6 @@ class Connection extends AbstractRestController {
* if a connection is changed (drag&drop) to another system. -> this function is called for update
* @param \Base $f3
* @throws \Exception
* @throws \ZMQSocketException
*/
public function put(\Base $f3){
$requestData = $this->getRequestData($f3);
@@ -71,7 +70,6 @@ class Connection extends AbstractRestController {
* @param \Base $f3
* @param $params
* @throws \Exception
* @throws \ZMQSocketException
*/
public function delete(\Base $f3, $params){
$requestData = $this->getRequestData($f3);

View File

@@ -68,7 +68,6 @@ class System extends AbstractRestController {
/**
* @param \Base $f3
* @param $params
* @throws \ZMQSocketException
* @throws \Exception
*/
public function delete(\Base $f3, $params){
@@ -128,7 +127,6 @@ class System extends AbstractRestController {
* @param Model\SystemModel $system
* @param array $systemData
* @return Model\SystemModel
* @throws \ZMQSocketException
* @throws \Exception
*/
private function update(Model\SystemModel $system, array $systemData) : Model\SystemModel {

View File

@@ -200,7 +200,6 @@ class User extends Controller\Controller{
/**
* log the current user out + clear character system log data
* @param \Base $f3
* @throws \ZMQSocketException
*/
public function logout(\Base $f3){
$this->logoutCharacter($f3, false, true, true, true);
@@ -355,7 +354,6 @@ class User extends Controller\Controller{
* delete current user account from DB
* @param \Base $f3
* @throws Exception
* @throws \ZMQSocketException
*/
public function deleteAccount(\Base $f3){
$data = $f3->get('POST.formData');