This commit is contained in:
2021-08-12 12:40:06 +08:00
parent 39af292171
commit 9a6c7b835b
19 changed files with 655 additions and 29 deletions
+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;
}