This commit is contained in:
2021-11-18 11:37:12 +08:00
parent adc63be3e4
commit 740dc7ebbd
17 changed files with 27 additions and 27 deletions
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace Server\Contract;
interface OnBeforeShutdown
{
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Server\Contract;
use Swoole\Server;
/**
*
*/
interface OnCloseInterface
{
/**
* @param Server $server
* @param int $fd
*/
public function onClose(Server $server, int $fd): void;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace Server\Contract;
use Swoole\Server;
interface OnConnectInterface
{
/**
* @param Server $server
* @param int $fd
* @return void
*/
public function onConnect(Server $server, int $fd): void;
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Server\Contract;
use Swoole\Server;
interface OnDisconnectInterface
{
/**
* @param Server $server
* @param int $fd
*/
public function onDisconnect(Server $server, int $fd): void;
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace Server\Contract;
use Swoole\Http\Response;
interface OnDownloadInterface
{
public function dispatch(Response $response);
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Server\Contract;
use Swoole\Http\Request;
use Swoole\Http\Response;
/**
*
*/
interface OnHandshakeInterface
{
/**
* @param Request $request
* @param Response $response
*/
public function onHandshake(Request $request, Response $response): void;
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Server\Contract;
use Swoole\Server;
use Swoole\WebSocket\Frame;
interface OnMessageInterface
{
/**
* @param Server $server
* @param Frame $frame
* @return void
*/
public function onMessage(Server $server, Frame $frame): void;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace Server\Contract;
use Swoole\Http\Request;
use Swoole\WebSocket\Server;
interface OnOpenInterface
{
/**
* @param Server $server
* @param Request $request
*/
public function onOpen(Server $server, Request $request): void;
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Server\Contract;
use Server\Abstracts\Server;
interface OnPacketInterface
{
/**
* @param Server $server
* @param string $data
* @param array $clientInfo
* @return mixed
*/
public function onPacket(Server $server, string $data, array $clientInfo): void;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace Server\Contract;
/**
* Interface OnPipeMessageInterface
* @package Server\Contract
*/
interface OnPipeMessageInterface
{
/**
*
*/
public function process(): void;
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Server\Contract;
use Swoole\Process;
/**
* Interface BaseProcess
* @package Contract
*/
interface OnProcessInterface
{
/**
* @param Process $process
* @return string
*/
public function getProcessName(Process $process): string;
/**
* @param Process $process
*/
public function signListen(Process $process): void;
/**
* @param Process $process
*/
public function onHandler(Process $process): void;
/**
*
*/
public function onProcessStop(): void;
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Server\Contract;
use Swoole\Server;
/**
*
*/
interface OnReceiveInterface
{
/**
* @param Server $server
* @param int $fd
* @param int $reactor_id
* @param string $data
* @return void
*/
public function onReceive(Server $server, int $fd, int $reactor_id, string $data): void;
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Server\Contract;
use Swoole\Server;
interface OnTaskInterface
{
public function execute();
public function finish(Server $server, int $task_id);
}