fix(realtime): phpdoc and access modifiers
This commit is contained in:
parent
03b03bbcc2
commit
d8bae25438
2 changed files with 43 additions and 38 deletions
|
@ -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:
|
||||
|
|
|
@ -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,14 +315,7 @@ class Server
|
|||
|
||||
/**
|
||||
* This is executed when an event is published on realtime channel in Redis.
|
||||
* @param string $payload
|
||||
* @param SwooleServer $server
|
||||
* @param int $workerId
|
||||
* @return void
|
||||
*/
|
||||
public function onRedisPublish(string $payload, SwooleServer &$server, int $workerId)
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Supported Resources:
|
||||
* - Collection
|
||||
* - Document
|
||||
|
@ -329,7 +326,14 @@ class Server
|
|||
* - Membership? (not implemented yet)
|
||||
* - Function
|
||||
* - Execution
|
||||
*
|
||||
* @param string $payload
|
||||
* @param SwooleServer $server
|
||||
* @param int $workerId
|
||||
* @return void
|
||||
*/
|
||||
private function onRedisPublish(string $payload, SwooleServer &$server, int $workerId)
|
||||
{
|
||||
$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)
|
||||
|
|
Loading…
Reference in a new issue