PHP Class Aerys\Server

Inheritance: implements SplSubject, use trait Struct
Afficher le fichier Open project: amphp/aerys Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Options $options, VhostContainer $vhosts, Psr\Log\LoggerInterface $logger, Ticker $ticker )
__debugInfo ( )
attach ( aerys\ServerObserver $observer ) : void Attach an observer
detach ( aerys\ServerObserver $observer ) : void Detach an Observer
getOption ( string $option ) Retrieve a server option value
monitor ( ) : array
setOption ( string $option, mixed $newValue ) : void Assign a server option value
start ( ) : Promise Start the server
state ( ) : integer Retrieve the current server state
stop ( ) : Promise Stop the server

Private Methods

Méthode Description
bind ( string $address, $context )
clear ( Client $client )
clearKeepAliveTimeout ( Client $client )
close ( Client $client )
doStart ( ) : Generator
doStop ( ) : Generator
dropPrivileges ( )
export ( Client $client ) : Closure
failCryptoNegotiation ( $socket, $ip )
generateBindableAddressContextMap ( )
importClient ( $socket, $ip, $port )
initializeRequest ( Client $client, array $parseResult ) : InternalRequest
initializeResponse ( InternalRequest $ireq, array $filters ) : aerys\Response
logDebug ( $message ) This function MUST always return TRUE. It should only be invoked inside an assert() block so that we can cancel its opcodes when in production mode. This approach allows us to take full advantage of debug mode log output without adding superfluous method call overhead in production environments.
makePrivateCallable ( string $method ) : Closure We frequently have to pass callables to outside code (like amp).
negotiateCrypto ( string $watcherId, $socket, $peer )
notify ( ) : Promise Notify observers of a server state change
onAcceptable ( string $watcherId, $server )
onApplicationError ( Throwable $error, InternalRequest $ireq, aerys\Response $response, array $filters )
onCoroutineAppResolve ( $error, $result, $info )
onEntitySizeWarning ( Client $client, array $parseResult )
onParseEmit ( Client $client, $eventType, $parseResult, $errorStruct = null )
onParseError ( Client $client, array $parseResult, string $error )
onParsedEntityHeaders ( Client $client, array $parseResult )
onParsedEntityPart ( Client $client, array $parseResult )
onParsedMessageWithEntity ( Client $client, array $parseResult )
onParsedMessageWithoutEntity ( Client $client, array $parseResult )
onReadable ( string $watcherId, $socket, $client )
onResponseDataDone ( Client $client )
onWritable ( string $watcherId, $socket, $client )
renewKeepAliveTimeout ( Client $client )
respond ( InternalRequest $ireq )
sendPreAppInvalidHostResponse ( aerys\Request $request, aerys\Response $response )
sendPreAppMethodNotAllowedResponse ( aerys\Request $request, aerys\Response $response )
sendPreAppOptionsResponse ( aerys\Request $request, aerys\Response $response )
sendPreAppServiceUnavailableResponse ( aerys\Request $request, aerys\Response $response )
sendPreAppTraceResponse ( aerys\Request $request, aerys\Response $response )
setTrace ( InternalRequest $ireq )
timeoutKeepAlives ( integer $now )
tryApplication ( InternalRequest $ireq, callable $application, array $filters )
tryErrorResponse ( Throwable $error, InternalRequest $ireq, aerys\Response $response, array $filters )
tryFilterErrorResponse ( Throwable $error, InternalRequest $ireq, array $filters ) When an uncaught exception is thrown by a filter we enable the $ireq->filterErrorFlag and add the offending filter's key to $ireq->badFilterKeys. Each time we initialize a response the bad filters are removed from the chain in an effort to invoke all possible filters. To handle the scenario where multiple filters error we need to continue looping until $ireq->filterErrorFlag no longer reports as true.
writeResponse ( Client $client, $final = false )

Method Details

__construct() public méthode

public __construct ( Options $options, VhostContainer $vhosts, Psr\Log\LoggerInterface $logger, Ticker $ticker )
$options Options
$vhosts VhostContainer
$logger Psr\Log\LoggerInterface
$ticker Ticker

__debugInfo() public méthode

public __debugInfo ( )

attach() public méthode

Attach an observer
public attach ( aerys\ServerObserver $observer ) : void
$observer aerys\ServerObserver
Résultat void

detach() public méthode

Detach an Observer
public detach ( aerys\ServerObserver $observer ) : void
$observer aerys\ServerObserver
Résultat void

getOption() public méthode

Retrieve a server option value
public getOption ( string $option )
$option string The option to retrieve

monitor() public méthode

public monitor ( ) : array
Résultat array

setOption() public méthode

Assign a server option value
public setOption ( string $option, mixed $newValue ) : void
$option string The option to retrieve
$newValue mixed
Résultat void

start() public méthode

Start the server
public start ( ) : Promise
Résultat Promise

state() public méthode

Retrieve the current server state
public state ( ) : integer
Résultat integer

stop() public méthode

Stop the server
public stop ( ) : Promise
Résultat Promise