Property | Type | Description | |
---|---|---|---|
$defaultMaxSendBufferSize | integer | Default send buffer size. | |
$id | integer | Connection->id. | |
$maxPackageSize | integer | Maximum acceptable packet size. | |
$maxSendBufferSize | integer | OnBufferFull callback will be emited When the send buffer is full. | |
$onBufferDrain | callback | Emitted when the send buffer becomes empty. | |
$onBufferFull | callback | Emitted when the send buffer becomes full. | |
$onClose | callback | Emitted when the other end of the socket sends a FIN packet. | |
$onError | callback | Emitted when an error occurs with connection. | |
$onMessage | callback | Emitted when data is received. | |
$protocol | Workerman\Protocols\ProtocolInterface | The format is like this Workerman\\Protocols\\Http. | |
$worker | Which worker belong to. |
Property | Type | Description | |
---|---|---|---|
$_currentPackageLength | integer | Current package length. | |
$_id | integer | A copy of $worker->id which used to clean up the connection in worker->connections | |
$_idRecorder | integer | Id recorder. | |
$_isPaused | boolean | Is paused. | |
$_recvBuffer | string | Receive buffer. | |
$_remoteAddress | string | Remote address. | |
$_sendBuffer | string | Send buffer. | |
$_socket | resource | Socket | |
$_status | integer | Connection status. |
Method | Description | |
---|---|---|
__construct ( resource $socket, string $remote_address = '' ) | Construct. | |
__destruct ( ) : void | Destruct. | |
baseRead ( resource $socket, boolean $check_eof = true ) : void | Base read handler. | |
baseWrite ( ) : void | boolean | Base write handler. | |
close ( mixed $data = null, boolean $raw = false ) : void | Close connection. | |
consumeRecvBuffer ( integer $length ) : void | Remove $length of data from receive buffer. | |
destroy ( ) : void | Destroy connection. | |
getRemoteIp ( ) : string | Get remote IP. | |
getRemotePort ( ) : integer | Get remote port. | |
getSocket ( ) : resource | Get the real socket. | |
pauseRecv ( ) : void | Pauses the reading of data. That is onMessage will not be emitted. Useful to throttle back an upload. | |
pipe ( |
This method pulls all the data out of a readable stream, and writes it to the supplied destination. | |
resumeRecv ( ) : void | Resumes reading after a call to pauseRecv. | |
send ( string $send_buffer, boolean $raw = false ) : void | boolean | null | Sends data on the connection. |
Method | Description | |
---|---|---|
bufferIsFull ( ) : boolean | Whether send buffer is full. | |
checkBufferWillFull ( ) : void | Check whether the send buffer will be full. |
public __construct ( resource $socket, string $remote_address = '' ) | ||
$socket | resource | |
$remote_address | string |
protected bufferIsFull ( ) : boolean | ||
return | boolean |
protected checkBufferWillFull ( ) : void | ||
return | void |
public consumeRecvBuffer ( integer $length ) : void | ||
$length | integer | |
return | void |
public resumeRecv ( ) : void | ||
return | void |
protected int $_currentPackageLength | ||
return | integer |
protected int $_id | ||
return | integer |
protected static int $_idRecorder | ||
return | integer |
protected string $_remoteAddress | ||
return | string |
public static int $defaultMaxSendBufferSize | ||
return | integer |
public static int $maxPackageSize | ||
return | integer |
public int $maxSendBufferSize | ||
return | integer |
public callback $onBufferDrain | ||
return | callback |
public callback $onBufferFull | ||
return | callback |
public callback $onClose | ||
return | callback |
public callback $onError | ||
return | callback |
public callback $onMessage | ||
return | callback |
public ProtocolInterface,Workerman\Protocols $protocol | ||
return | Workerman\Protocols\ProtocolInterface |