forked from easy-swoole/doc-3.3.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EasySwooleEvent.php
35 lines (28 loc) · 911 Bytes
/
EasySwooleEvent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace EasySwoole\EasySwoole;
use App\Utility\TickProcess;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use EasySwoole\EasySwoole\AbstractInterface\Event;
use EasySwoole\Http\Request;
use EasySwoole\Http\Response;
class EasySwooleEvent implements Event
{
public static function initialize()
{
// TODO: Implement initialize() method.
date_default_timezone_set('Asia/Shanghai');
}
public static function mainServerCreate(EventRegister $register)
{
$process = new TickProcess('TickProcess');
ServerManager::getInstance()->getSwooleServer()->addProcess($process->getProcess());
}
public static function onRequest(Request $request, Response $response): bool
{
return true;
}
public static function afterRequest(Request $request, Response $response): void
{
// TODO: Implement afterAction() method.
}
}