Properties

$startFuncMap

$startFuncMap : array

Type

array

$workerId

$workerId

$pool

$pool : \Swoole\Process\Pool

Type

\Swoole\Process\Pool —

$ipc

$ipc : \adminmatrix\swoole\Ipc

Type

Ipc

$currentTable

$currentTable : \adminmatrix\swoole\Table

Type

Table

$host

$host : string

Type

string

$port

$port : int

Type

int

$options

$options : array

Type

array

$lock

$lock : \adminmatrix\swoole\Lock

Type

Lock

$container

$container : \think\App

Type

\think\App —

$registerServer

$registerServer

$gatewayProcesses

$gatewayProcesses

$app

$app : \adminmatrix\swoole\App

Type

App

Methods

addBatchWorker()

addBatchWorker(int  $workerNum, callable  $func, mixed  $name = null) : mixed

Parameters

int $workerNum
callable $func
mixed $name

Returns

mixed —

addWorker()

addWorker(callable  $func, mixed  $name = null) : self

Parameters

callable $func
mixed $name

Returns

self —

start()

start(string  $envName) : void

启动服务

Parameters

string $envName

环境变量标识

getWorkerId()

getWorkerId() : mixed

Returns

mixed —

getPool()

getPool() : \Swoole\Process\Pool

获取当前工作进程池对象

Returns

\Swoole\Process\Pool —

sendMessage()

sendMessage(mixed  $workerId, mixed  $message) : mixed

Parameters

mixed $workerId
mixed $message

Returns

mixed —

runWithBarrier()

runWithBarrier(callable  $func, mixed  ...$params) : mixed

Parameters

callable $func
mixed $params variadic

Returns

mixed —

createHttpServer()

createHttpServer() : mixed

Returns

mixed —

onRequest()

onRequest(\Swoole\Http\Request  $req, \Swoole\Http\Response  $res) : mixed

"onRequest" listener.

Parameters

\Swoole\Http\Request $req
\Swoole\Http\Response $res

Returns

mixed —

getPools()

getPools() : \adminmatrix\swoole\Pool

Returns

\adminmatrix\swoole\Pool —

prepareQueue()

prepareQueue() : mixed

Returns

mixed —

__construct()

__construct(\think\App  $container) : mixed

Manager constructor.

Parameters

\think\App $container

Returns

mixed —

getConfig()

getConfig(string  $name, mixed  $default = null) : mixed

获取配置

Parameters

string $name
mixed $default

Returns

mixed —

triggerEvent()

triggerEvent(string  $event, null  $params = null) : void

触发事件

Parameters

string $event
null $params

onEvent()

onEvent(string  $event,  $listener, bool  $first = false) : void

监听事件

Parameters

string $event
$listener
bool $first

logServerError()

logServerError(\Throwable  $e) : mixed

Log server error.

Parameters

\Throwable $e

Returns

mixed —

createGatewayServer()

createGatewayServer() : mixed

Returns

mixed —

getApplication()

getApplication() : mixed

Returns

mixed —

runInSandbox()

runInSandbox(\Closure  $callable) : mixed

在沙箱中执行

Parameters

\Closure $callable

Returns

mixed —

stopWorker()

stopWorker() : mixed

Returns

mixed —

createPool()

createPool(mixed  $workerNum) : mixed

Parameters

mixed $workerNum

Returns

mixed —

addHotUpdateProcess()

addHotUpdateProcess() : mixed

热更新

Returns

mixed —

clearCache()

clearCache() : mixed

清除apc、op缓存

Returns

mixed —

setProcessName()

setProcessName( $process) : mixed

Set process name.

Parameters

$process

Returns

mixed —

prepareTables()

prepareTables() : mixed

Register customized swoole tables.

Returns

mixed —

registerTables()

registerTables() : mixed

Register user-defined swoole tables.

Returns

mixed —

preloadHttp()

preloadHttp() : mixed

Returns

mixed —

isWebsocketRequest()

isWebsocketRequest(\Swoole\Http\Request  $req) : mixed

Parameters

\Swoole\Http\Request $req

Returns

mixed —

prepareHttp()

prepareHttp() : mixed

Returns

mixed —

handleRequest()

handleRequest(\think\Http  $http, mixed  $request) : mixed

Parameters

\think\Http $http
mixed $request

Returns

mixed —

prepareRequest()

prepareRequest(\Swoole\Http\Request  $req) : mixed

Parameters

\Swoole\Http\Request $req

Returns

mixed —

prepareResponse()

prepareResponse(\think\Response  $response) : mixed

Parameters

\think\Response $response

Returns

mixed —

getFiles()

getFiles(\Swoole\Http\Request  $req) : mixed

Parameters

\Swoole\Http\Request $req

Returns

mixed —

setCookie()

setCookie(\Swoole\Http\Response  $res, \think\Cookie  $cookie) : mixed

Parameters

\Swoole\Http\Response $res
\think\Cookie $cookie

Returns

mixed —

setHeader()

setHeader(\Swoole\Http\Response  $res, array  $headers) : mixed

Parameters

\Swoole\Http\Response $res
array $headers

Returns

mixed —

setStatus()

setStatus(\Swoole\Http\Response  $res, mixed  $code) : mixed

Parameters

\Swoole\Http\Response $res
mixed $code

Returns

mixed —

sendResponse()

sendResponse(\Swoole\Http\Response  $res, \think\Request  $request, \think\Response  $response) : mixed

Parameters

\Swoole\Http\Response $res
\think\Request $request
\think\Response $response

Returns

mixed —

sendIterator()

sendIterator(\Swoole\Http\Response  $res, \adminmatrix\swoole\response\Iterator  $response) : mixed

Parameters

\Swoole\Http\Response $res
\adminmatrix\swoole\response\Iterator $response

Returns

mixed —

sendFile()

sendFile(\Swoole\Http\Response  $res, \think\Request  $request, \adminmatrix\swoole\response\File  $response) : mixed

Parameters

\Swoole\Http\Response $res
\think\Request $request
\adminmatrix\swoole\response\File $response

Returns

mixed —

sendContent()

sendContent(\Swoole\Http\Response  $res, \think\Response  $response) : mixed

Parameters

\Swoole\Http\Response $res
\think\Response $response

Returns

mixed —

preparePools()

preparePools() : mixed

Returns

mixed —

prepareRpcClient()

prepareRpcClient() : mixed

Returns

mixed —

bindRpcInterface()

bindRpcInterface() : mixed

Returns

mixed —

bindRpcClientPool()

bindRpcClientPool() : mixed

Returns

mixed —

createRpcConnector()

createRpcConnector(mixed  $name) : mixed

Parameters

mixed $name

Returns

mixed —

createRpcServer()

createRpcServer() : mixed

Returns

mixed —

prepareRpcServer()

prepareRpcServer() : mixed

Returns

mixed —

bindRpcDispatcher()

bindRpcDispatcher() : mixed

Returns

mixed —

bindRpcParser()

bindRpcParser() : mixed

Returns

mixed —

createQueueWorkers()

createQueueWorkers() : mixed

Returns

mixed —

listenForEvents()

listenForEvents() : mixed

注册事件

Returns

mixed —

logFailedJob()

logFailedJob(\think\queue\event\JobFailed  $event) : mixed

记录失败任务

Parameters

\think\queue\event\JobFailed $event

Returns

mixed —

prepareTracing()

prepareTracing() : mixed

Returns

mixed —

bindTracingRedisReporter()

bindTracingRedisReporter() : mixed

Returns

mixed —

bindTracingRedisPool()

bindTracingRedisPool() : mixed

Returns

mixed —

prepareLock()

prepareLock() : mixed

Returns

mixed —

getContainer()

getContainer() : mixed

Returns

mixed —

prepareGateway()

prepareGateway() : mixed

Returns

mixed —

startGatewayProcess()

startGatewayProcess(mixed  $config, mixed  $index) : mixed

Parameters

mixed $config
mixed $index

Returns

mixed —

runGatewayService()

runGatewayService(mixed  $config) : mixed

Parameters

mixed $config

Returns

mixed —

preloadGateway()

preloadGateway() : mixed

Returns

mixed —

registerRegister()

registerRegister() : mixed

Returns

mixed —

startRegisterServer()

startRegisterServer() : mixed

Returns

mixed —

prepareApplication()

prepareApplication(string  $envName) : mixed

Parameters

string $envName

Returns

mixed —

prepareConcretes()

prepareConcretes() : mixed

预加载

Returns

mixed —

getSandbox()

getSandbox() : \adminmatrix\swoole\Sandbox

获取沙箱

Returns

\adminmatrix\swoole\Sandbox —

initialize()

initialize() : void

Initialize.