PHP Class PHPDaemon\WebSocket\Route

Author: Vasily Zorin ([email protected])
Inheritance: implements PHPDaemon\WebSocket\RouteInterface, use trait PHPDaemon\Traits\StaticObjectWatchdog, use trait PHPDaemon\Traits\Sessions, use trait PHPDaemon\Traits\DeferredEventHandlers
Datei anzeigen Open project: kakserpom/phpdaemon Class Usage Examples

Public Properties

Property Type Description
$appInstance PHPDaemon\Core\AppInstance
$attrs
$client PHPDaemon\Servers\WebSocket\Connection

Protected Properties

Property Type Description
$running

Public Methods

Method Description
__construct ( Connection $client, AppInstance $appInstance = null ) Called when client connected.
gracefulShutdown ( ) : boolean Called when the worker is going to shutdown.
handleException ( $e ) : boolean Uncaught exception handler
onFinish ( ) : void Called when session finished.
onFrame ( string $data, integer $type ) : void Called when new frame is received
onHandshake ( ) : void Called when the connection is handshaked.
onSleep ( ) : void Called when the request starts sleep
onWakeup ( ) : void Called when the request wakes up
setcookie ( string $name, string $value = '', integer $maxage, string $path = '', string $domain = '', boolean $secure = false, boolean $HTTPOnly = false ) : void Set the cookie

Protected Methods

Method Description
getCookieStr ( string $name ) : string Get cookie by name
getSessionState ( ) : mixed Get session state
setSessionState ( mixed $var ) : void Set session state

Method Details

__construct() public method

Called when client connected.
public __construct ( Connection $client, AppInstance $appInstance = null )
$client PHPDaemon\Servers\WebSocket\Connection Remote client
$appInstance PHPDaemon\Core\AppInstance

getCookieStr() protected method

Get cookie by name
protected getCookieStr ( string $name ) : string
$name string Name of cookie
return string Contents

getSessionState() protected method

Get session state
protected getSessionState ( ) : mixed
return mixed

gracefulShutdown() public method

Called when the worker is going to shutdown.
public gracefulShutdown ( ) : boolean
return boolean Ready to shutdown?

handleException() public method

Uncaught exception handler
public handleException ( $e ) : boolean
$e
return boolean Handled?

onFinish() public method

Called when session finished.
public onFinish ( ) : void
return void

onFrame() public method

Called when new frame is received
public onFrame ( string $data, integer $type ) : void
$data string Frame's contents
$type integer Frame's type
return void

onHandshake() public method

Called when the connection is handshaked.
public onHandshake ( ) : void
return void

onSleep() public method

Called when the request starts sleep
public onSleep ( ) : void
return void

onWakeup() public method

Called when the request wakes up
public onWakeup ( ) : void
return void

setSessionState() protected method

Set session state
protected setSessionState ( mixed $var ) : void
$var mixed
return void

setcookie() public method

Set the cookie
public setcookie ( string $name, string $value = '', integer $maxage, string $path = '', string $domain = '', boolean $secure = false, boolean $HTTPOnly = false ) : void
$name string Name of cookie
$value string Value
$maxage integer Optional. Max-Age. Default is 0.
$path string Optional. Path. Default is empty string.
$domain string Optional. Domain. Default is empty string.
$secure boolean Optional. Secure. Default is false.
$HTTPOnly boolean Optional. HTTPOnly. Default is false.
return void

Property Details

$appInstance public_oe property

public AppInstance,PHPDaemon\Core $appInstance
return PHPDaemon\Core\AppInstance

$attrs public_oe property

public $attrs

$client public_oe property

public Connection,PHPDaemon\Servers\WebSocket $client
return PHPDaemon\Servers\WebSocket\Connection

$running protected_oe property

protected $running