PHP Class PHPDaemon\Servers\WebSocket\Connection

Inheritance: extends PHPDaemon\Network\Connection, use trait PHPDaemon\Traits\DeferredEventHandlers, use trait PHPDaemon\Traits\Sessions
Afficher le fichier Open project: kakserpom/phpdaemon Class Usage Examples

Méthodes publiques

Свойство Type Description
$cookie _COOKIE
$get _GET
$hvaltr Replacement pairs for processing some header values in parse_str()
$server _SERVER

Protected Properties

Свойство Type Description
$EOL
$contentLength Content length from header() method
$cookieNum Number of outgoing cookie-headers
$currentHeader
$extensions
$extensionsCleanRegex
$handshaked
$headers
$headers_sent
$policyReqNotFound
$route
$running Is this connection running right now?
$timeout Timeout
$writeReady

Méthodes publiques

Méthode Description
badRequest ( ) : void Send Bad request
getFrameType ( $type ) : integer Get real frame type identificator
gracefulShutdown ( ) : boolean Called when the worker is going to shutdown.
handleException ( Exception $e ) : boolean Uncaught exception handler
handshake ( ) : boolean Called when we're going to handshake.
header ( string $s, boolean $replace = true, boolean $code = false ) : boolean Send the header
onFinish ( ) : void Event of Connection.
onFrame ( string $data, string $type ) : boolean Called when new frame received.
onInheritance ( $conn )
onInheritanceFromRequest ( object $req ) : void Called when connection is inherited from HTTP request
onReady ( ) : void Called when the stream is handshaked (at low-level), and peer is ready to recv. data
sendFrame ( string $data, string $type = null, callable $cb = null ) : boolean Sends a frame.
status ( integer $code = 200 ) : boolean Send HTTP-status

Méthodes protégées

Méthode Description
handshakeAfter ( )
httpProcessHeaders ( ) : boolean Process headers
httpReadFirstline ( ) : boolean | null Read first line of HTTP request
httpReadHeaders ( ) : boolean | null Read headers line-by-line
onRead ( ) : void Called when new data received.
switchToProtocol ( $proto )

Method Details

badRequest() public méthode

Send Bad request
public badRequest ( ) : void
Résultat void

getFrameType() public méthode

Get real frame type identificator
public getFrameType ( $type ) : integer
$type
Résultat integer

gracefulShutdown() public méthode

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

handleException() public méthode

Uncaught exception handler
public handleException ( Exception $e ) : boolean
$e Exception
Résultat boolean Handled?

handshake() public méthode

Called when we're going to handshake.
public handshake ( ) : boolean
Résultat boolean Handshake status

handshakeAfter() protected méthode

protected handshakeAfter ( )

header() public méthode

Send the header
public header ( string $s, boolean $replace = true, boolean $code = false ) : boolean
$s string Header. Example: 'Location: http://php.net/'
$replace boolean Optional. Replace?
$code boolean Optional. HTTP response code
Résultat boolean Success

httpProcessHeaders() protected méthode

Process headers
protected httpProcessHeaders ( ) : boolean
Résultat boolean

httpReadFirstline() protected méthode

Read first line of HTTP request
protected httpReadFirstline ( ) : boolean | null
Résultat boolean | null Success

httpReadHeaders() protected méthode

Read headers line-by-line
protected httpReadHeaders ( ) : boolean | null
Résultat boolean | null Success

onFinish() public méthode

Event of Connection.
public onFinish ( ) : void
Résultat void

onFrame() public méthode

Called when new frame received.
public onFrame ( string $data, string $type ) : boolean
$data string Frame's data.
$type string Frame's type ("STRING" OR "BINARY").
Résultat boolean Success.

onInheritance() public méthode

public onInheritance ( $conn )

onInheritanceFromRequest() public méthode

Called when connection is inherited from HTTP request
public onInheritanceFromRequest ( object $req ) : void
$req object
Résultat void

onRead() protected méthode

Called when new data received.
protected onRead ( ) : void
Résultat void

onReady() public méthode

Called when the stream is handshaked (at low-level), and peer is ready to recv. data
public onReady ( ) : void
Résultat void

sendFrame() public méthode

Sends a frame.
public sendFrame ( string $data, string $type = null, callable $cb = null ) : boolean
$data string Frame's data.
$type string Frame's type. ("STRING" OR "BINARY")
$cb callable Optional. Callback called when the frame is received by client.
Résultat boolean Success.

status() public méthode

Send HTTP-status
public status ( integer $code = 200 ) : boolean
$code integer Code
Résultat boolean Success

switchToProtocol() protected méthode

protected switchToProtocol ( $proto )

Property Details

$EOL protected_oe property

protected $EOL

$contentLength protected_oe property

Content length from header() method
protected $contentLength

$cookieNum protected_oe property

Number of outgoing cookie-headers
protected $cookieNum

$currentHeader protected_oe property

protected $currentHeader

$extensions protected_oe property

protected $extensions

$extensionsCleanRegex protected_oe property

protected $extensionsCleanRegex

$get public_oe property

_GET
public $get

$handshaked protected_oe property

protected $handshaked

$headers protected_oe property

protected $headers

$headers_sent protected_oe property

protected $headers_sent

$hvaltr public_oe static_oe property

Replacement pairs for processing some header values in parse_str()
public static $hvaltr

$policyReqNotFound protected_oe property

protected $policyReqNotFound

$route protected_oe property

protected $route

$running protected_oe property

Is this connection running right now?
protected $running

$server public_oe property

_SERVER
public $server

$timeout protected_oe property

Timeout
protected $timeout

$writeReady protected_oe property

protected $writeReady