From d8bae254383f5acd4d5e0db3d4fde704eed629e8 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 15 Jun 2021 09:15:14 +0200 Subject: [PATCH] fix(realtime): phpdoc and access modifiers --- docker-compose.yml | 38 ++++++++++++++-------------- src/Appwrite/Realtime/Server.php | 43 ++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 90e6c16d5..17fac88c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -550,24 +550,24 @@ services: # - RESQUE_WEB_HTTP_BASIC_AUTH_USER=user # - RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=password - # chronograf: - # image: chronograf:1.5 - # container_name: appwrite-chronograf - # restart: unless-stopped - # networks: - # - appwrite - # volumes: - # - appwrite-chronograf:/var/lib/chronograf - # ports: - # - "8888:8888" - # environment: - # - INFLUXDB_URL=http://influxdb:8086 - # - KAPACITOR_URL=http://kapacitor:9092 - # - AUTH_DURATION=48h - # - TOKEN_SECRET=duperduper5674829!jwt - # - GH_CLIENT_ID=d86f7145a41eacfc52cc - # - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab - # - GH_ORGS=appwrite + chronograf: + image: chronograf:1.5 + container_name: appwrite-chronograf + restart: unless-stopped + networks: + - appwrite + volumes: + - appwrite-chronograf:/var/lib/chronograf + ports: + - "8888:8888" + environment: + - INFLUXDB_URL=http://influxdb:8086 + - KAPACITOR_URL=http://kapacitor:9092 + - AUTH_DURATION=48h + - TOKEN_SECRET=duperduper5674829!jwt + - GH_CLIENT_ID=d86f7145a41eacfc52cc + - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab + - GH_ORGS=appwrite # webgrind: # image: 'jokkedk/webgrind:latest' @@ -591,4 +591,4 @@ volumes: appwrite-functions: appwrite-influxdb: appwrite-config: - # appwrite-chronograf: + appwrite-chronograf: diff --git a/src/Appwrite/Realtime/Server.php b/src/Appwrite/Realtime/Server.php index 0eed3f24b..d8baec585 100644 --- a/src/Appwrite/Realtime/Server.php +++ b/src/Appwrite/Realtime/Server.php @@ -55,10 +55,11 @@ class Server /** * This is executed when the Realtime server starts. + * * @param SwooleServer $server * @return void */ - public function onStart(SwooleServer $server): void + private function onStart(SwooleServer $server): void { Console::success('Server started succefully'); Console::info("Master pid {$server->master_pid}, manager pid {$server->manager_pid}"); @@ -101,12 +102,13 @@ class Server /** * This is executed when a WebSocket worker process starts. + * * @param SwooleServer $server * @param int $workerId * @return void * @throws Exception */ - public function onWorkerStart(SwooleServer $server, int $workerId): void + private function onWorkerStart(SwooleServer $server, int $workerId): void { Console::success('Worker ' . $workerId . ' started succefully'); @@ -163,7 +165,7 @@ class Server * @throws Exception * @throws UtopiaException */ - public function onOpen(SwooleServer $server, Request $request): void + private function onOpen(SwooleServer $server, Request $request): void { $app = new App('UTC'); $connection = $request->fd; @@ -284,11 +286,12 @@ class Server /** * This is executed when a message is received by the Realtime server. + * * @param SwooleServer $server * @param Frame $frame * @return void */ - public function onMessage(SwooleServer $server, Frame $frame) + private function onMessage(SwooleServer $server, Frame $frame) { $server->push($frame->fd, 'Sending messages is not allowed.'); $server->close($frame->fd); @@ -296,11 +299,12 @@ class Server /** * This is executed when a Realtime connection is closed. + * * @param SwooleServer $server * @param int $connection * @return void */ - public function onClose(SwooleServer $server, int $connection) + private function onClose(SwooleServer $server, int $connection) { if (array_key_exists($connection, $this->connections)) { $this->stats->decr($this->connections[$connection]['projectId'], 'connectionsTotal'); @@ -311,25 +315,25 @@ class Server /** * This is executed when an event is published on realtime channel in Redis. + * + * Supported Resources: + * - Collection + * - Document + * - File + * - Account + * - Session + * - Team? (not implemented yet) + * - Membership? (not implemented yet) + * - Function + * - Execution + * * @param string $payload * @param SwooleServer $server * @param int $workerId * @return void */ - public function onRedisPublish(string $payload, SwooleServer &$server, int $workerId) + private function onRedisPublish(string $payload, SwooleServer &$server, int $workerId) { - /** - * Supported Resources: - * - Collection - * - Document - * - File - * - Account - * - Session - * - Team? (not implemented yet) - * - Membership? (not implemented yet) - * - Function - * - Execution - */ $event = json_decode($payload, true); $receivers = Parser::identifyReceivers($event, $this->subscriptions); @@ -361,10 +365,11 @@ class Server /** * This sends the usage to the `console` channel. + * * @param SwooleServer $server * @return void */ - public function tickSendProjectUsage(SwooleServer &$server) + private function tickSendProjectUsage(SwooleServer &$server) { if ( array_key_exists('console', $this->subscriptions)