PHP Класс PHPDaemon\Servers\WebSocket\Connection

Наследование: extends PHPDaemon\Network\Connection, use trait PHPDaemon\Traits\DeferredEventHandlers, use trait PHPDaemon\Traits\Sessions
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cookie _COOKIE
$get _GET
$hvaltr Replacement pairs for processing some header values in parse_str()
$server _SERVER

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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 )

Описание методов

badRequest() публичный Метод

Send Bad request
public badRequest ( ) : void
Результат void

getFrameType() публичный Метод

Get real frame type identificator
public getFrameType ( $type ) : integer
$type
Результат integer

gracefulShutdown() публичный Метод

Called when the worker is going to shutdown.
public gracefulShutdown ( ) : boolean
Результат boolean Ready to shutdown ?

handleException() публичный Метод

Uncaught exception handler
public handleException ( Exception $e ) : boolean
$e Exception
Результат boolean Handled?

handshake() публичный Метод

Called when we're going to handshake.
public handshake ( ) : boolean
Результат boolean Handshake status

handshakeAfter() защищенный Метод

protected handshakeAfter ( )

header() публичный Метод

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
Результат boolean Success

httpProcessHeaders() защищенный Метод

Process headers
protected httpProcessHeaders ( ) : boolean
Результат boolean

httpReadFirstline() защищенный Метод

Read first line of HTTP request
protected httpReadFirstline ( ) : boolean | null
Результат boolean | null Success

httpReadHeaders() защищенный Метод

Read headers line-by-line
protected httpReadHeaders ( ) : boolean | null
Результат boolean | null Success

onFinish() публичный Метод

Event of Connection.
public onFinish ( ) : void
Результат void

onFrame() публичный Метод

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").
Результат boolean Success.

onInheritance() публичный Метод

public onInheritance ( $conn )

onInheritanceFromRequest() публичный Метод

Called when connection is inherited from HTTP request
public onInheritanceFromRequest ( object $req ) : void
$req object
Результат void

onRead() защищенный Метод

Called when new data received.
protected onRead ( ) : void
Результат void

onReady() публичный Метод

Called when the stream is handshaked (at low-level), and peer is ready to recv. data
public onReady ( ) : void
Результат void

sendFrame() публичный Метод

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.
Результат boolean Success.

status() публичный Метод

Send HTTP-status
public status ( integer $code = 200 ) : boolean
$code integer Code
Результат boolean Success

switchToProtocol() защищенный Метод

protected switchToProtocol ( $proto )

Описание свойств

$EOL защищенное свойство

protected $EOL

$contentLength защищенное свойство

Content length from header() method
protected $contentLength

$cookieNum защищенное свойство

Number of outgoing cookie-headers
protected $cookieNum

$currentHeader защищенное свойство

protected $currentHeader

$extensions защищенное свойство

protected $extensions

$extensionsCleanRegex защищенное свойство

protected $extensionsCleanRegex

$get публичное свойство

_GET
public $get

$handshaked защищенное свойство

protected $handshaked

$headers защищенное свойство

protected $headers

$headers_sent защищенное свойство

protected $headers_sent

$hvaltr публичное статическое свойство

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

$policyReqNotFound защищенное свойство

protected $policyReqNotFound

$route защищенное свойство

protected $route

$running защищенное свойство

Is this connection running right now?
protected $running

$server публичное свойство

_SERVER
public $server

$timeout защищенное свойство

Timeout
protected $timeout

$writeReady защищенное свойство

protected $writeReady