CoroutineWebServer
extends App
in package
协程化web服务进程
Table of Contents
Methods
- getConnectionCoroutineCount() : array<string|int, int>|int
- 获取连接的协程计数
- onClose() : void
- 连接关闭
- onConnect() : void
- 连接建立
- onMessage() : null
- onWorkerStart() : mixed
- onWorkerStop() : void
- 停止服务
- unsetConnectionCoroutineCount() : void
- 回收连接的协程计数
Methods
getConnectionCoroutineCount()
获取连接的协程计数
public
static getConnectionCoroutineCount([string|null $connectionId = null ]) : array<string|int, int>|int
Parameters
- $connectionId : string|null = null
Return values
array<string|int, int>|intonClose()
连接关闭
public
onClose(ConnectionInterface|mixed $connection, mixed ...$params) : void
- 不用返回值和参数标定是为了兼容
Parameters
- $connection : ConnectionInterface|mixed
- $params : mixed
onConnect()
连接建立
public
onConnect(ConnectionInterface $connection, mixed ...$params) : void
- 不用返回值和参数标定是为了兼容
Parameters
- $connection : ConnectionInterface
- $params : mixed
onMessage()
public
onMessage(ConnectionInterface|mixed $connection, Request|mixed $request, mixed ...$params) : null
Parameters
- $connection : ConnectionInterface|mixed
- $request : Request|mixed
- $params : mixed
Tags
Return values
nullonWorkerStart()
public
onWorkerStart(mixed $worker) : mixed
Parameters
- $worker : mixed
Tags
onWorkerStop()
停止服务
public
onWorkerStop(Worker|mixed $worker, mixed ...$params) : void
- 不用返回值和参数标定是为了兼容
Parameters
- $worker : Worker|mixed
- $params : mixed
unsetConnectionCoroutineCount()
回收连接的协程计数
public
static unsetConnectionCoroutineCount(string $connectionId[, bool $force = false ]) : void
Parameters
- $connectionId : string
- $force : bool = false