This commit is contained in:
2021-08-24 18:24:46 +08:00
parent 575f4b8520
commit 24c93edf2b
110 changed files with 5 additions and 6 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Server\SInterface;
use Swoole\Process;
/**
* Interface CustomProcess
* @package SInterface
*/
interface CustomProcess
{
/**
* @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;
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Server\SInterface;
use Swoole\Server;
/**
*
*/
interface OnClose
{
/**
* @param Server $server
* @param int $fd
*/
public function onClose(Server $server, int $fd): void;
/**
* @param Server $server
* @param int $fd
*/
public function onDisconnect(Server $server, int $fd): void;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace Server\SInterface;
use Swoole\Server;
interface OnConnect
{
/**
* @param Server $server
* @param int $fd
* @return void
*/
public function onConnect(Server $server, int $fd): void;
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Server\SInterface;
use Swoole\Http\Request;
use Swoole\Http\Response;
/**
*
*/
interface OnHandshake
{
/**
* @param Request $request
* @param Response $response
*/
public function onHandshake(Request $request, Response $response): void;
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Server\SInterface;
use Swoole\Server;
use Swoole\WebSocket\Frame;
interface OnMessage
{
/**
* @param Server $server
* @param Frame $frame
* @return void
*/
public function onMessage(Server $server, Frame $frame): void;
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Server\SInterface;
use Server\Abstracts\Server;
interface OnPacket
{
/**
* @param Server $server
* @param string $data
* @param array $clientInfo
* @return mixed
*/
public function onPacket(Server $server, string $data, array $clientInfo): void;
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Server\SInterface;
use Swoole\Server;
/**
*
*/
interface OnReceive
{
/**
* @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;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace Server\SInterface;
use Swoole\Http\Request;
use Swoole\Http\Response;
interface OnRequest
{
/**
* @param Request $request
* @param Response $response
*/
public function onRequest(Request $request, Response $response): void;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace Server\SInterface;
/**
* Interface PipeMessage
* @package Server\SInterface
*/
interface PipeMessage
{
/**
*
*/
public function process(): void;
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Server\SInterface;
use Swoole\Server;
interface TaskExecute
{
public function execute();
public function finish(Server $server, int $task_id);
}