PHP Class Kraken\Channel\Model\Socket\Socket

Inheritance: extends Kraken\Event\BaseEventEmitter, implements Kraken\Channel\ChannelModelInterface
Show file Open project: kraken-php/framework

Protected Properties

Property Type Description
$connectionPool Kraken\Channel\Model\Socket\Connection\ConnectionPool
$endpoint string
$flags string[]
$frameBuffer string[]
$hosts string[]
$id string
$isConnected boolean
$loop Kraken\Loop\LoopInterface
$offlineBuffer Kraken\Channel\Model\Socket\Buffer\Buffer
$onlineBuffer Kraken\Channel\Model\Socket\Buffer\Buffer
$options mixed[]
$socket Kraken\Ipc\Socket\SocketInterface | Kraken\Ipc\Socket\SocketListenerInterface | null
$type integer

Public Methods

Method Description
__construct ( Kraken\Loop\LoopInterface $loop, string[] $params )
__destruct ( )
broadcast ( $message )
getConnected ( )
isConnected ( $id )
isStarted ( )
isStopped ( )
markConnectionOnline ( string $id, float $until ) Set connection statically to be marked as online until specific timestamp.
markConnectionPersistent ( string $id ) Set connection statically to be marked always as online.
onData ( Kraken\Ipc\Socket\SocketInterface $client, string $data )
start ( $blockEvent = false )
stop ( $blockEvent = false )
unicast ( $id, $message, $flags = Channel::MODE_STANDARD )

Protected Methods

Method Description
createBinder ( ) : Kraken\Ipc\Socket\SocketListenerInterface
createConnector ( ) : Kraken\Ipc\Socket\SocketInterface
destroyBinder ( )
destroyConnector ( )
getBuffer ( ) : Buffer
getConnectionPool ( ) : ConnectionPool
parseBinderMessage ( string $message ) : string[]
parseConnectorMessage ( string $message ) : string[]
prepareBinderMessage ( string $id, string $type ) : string[]
prepareConnectorMessage ( string $id, string $type ) : string[]
removeEventListener ( string $event, callable $callback )
setEventListener ( string $event, callable $callback )

Private Methods

Method Description
clearConnectionPool ( ) Clear connection pool.
getFrame ( string $id, string $type, string $message ) : null | string
heartbeat ( string $id ) : boolean
onMessage ( Kraken\Ipc\Socket\SocketInterface $client, string $message )
onRecvHeartbeat ( Connection $conn )
onRecvMessage ( Connection $conn, string[] $message )
recvHeartbeat ( Connection $conn )
recvMessage ( Connection $conn, $message ) : mixed
sendMessage ( string $id, string $type, string | string[] $message = null, integer $flags = Channel::MODE_STANDARD ) : boolean
startConnection ( ) : boolean
startHeartbeat ( ) Start heartbeat.
startTimeRegister ( ) Start time register.
stopConnection ( ) : boolean
stopHeartbeat ( ) Stop hearbeat.
stopTimeRegister ( ) Stop time register.
writeData ( string $id, string $data ) : boolean

Method Details

__construct() public method

public __construct ( Kraken\Loop\LoopInterface $loop, string[] $params )
$loop Kraken\Loop\LoopInterface
$params string[]

__destruct() public method

public __destruct ( )

broadcast() public method

public broadcast ( $message )

createBinder() protected method

protected createBinder ( ) : Kraken\Ipc\Socket\SocketListenerInterface
return Kraken\Ipc\Socket\SocketListenerInterface

createConnector() protected method

protected createConnector ( ) : Kraken\Ipc\Socket\SocketInterface
return Kraken\Ipc\Socket\SocketInterface

destroyBinder() protected method

protected destroyBinder ( )

destroyConnector() protected method

protected destroyConnector ( )

getBuffer() protected method

protected getBuffer ( ) : Buffer
return Kraken\Channel\Model\Socket\Buffer\Buffer

getConnected() public method

public getConnected ( )

getConnectionPool() protected method

protected getConnectionPool ( ) : ConnectionPool
return Kraken\Channel\Model\Socket\Connection\ConnectionPool

isConnected() public method

public isConnected ( $id )

isStarted() public method

public isStarted ( )

isStopped() public method

public isStopped ( )

markConnectionOnline() public method

Set connection statically to be marked as online until specific timestamp.
public markConnectionOnline ( string $id, float $until )
$id string
$until float

markConnectionPersistent() public method

Set connection statically to be marked always as online.

onData() public method

public onData ( Kraken\Ipc\Socket\SocketInterface $client, string $data )
$client Kraken\Ipc\Socket\SocketInterface
$data string

parseBinderMessage() protected method

protected parseBinderMessage ( string $message ) : string[]
$message string
return string[]

parseConnectorMessage() protected method

protected parseConnectorMessage ( string $message ) : string[]
$message string
return string[]

prepareBinderMessage() protected method

protected prepareBinderMessage ( string $id, string $type ) : string[]
$id string
$type string
return string[]

prepareConnectorMessage() protected method

protected prepareConnectorMessage ( string $id, string $type ) : string[]
$id string
$type string
return string[]

removeEventListener() protected method

protected removeEventListener ( string $event, callable $callback )
$event string
$callback callable

setEventListener() protected method

protected setEventListener ( string $event, callable $callback )
$event string
$callback callable

start() public method

public start ( $blockEvent = false )

stop() public method

public stop ( $blockEvent = false )

unicast() public method

public unicast ( $id, $message, $flags = Channel::MODE_STANDARD )

Property Details

$connectionPool protected property

protected ConnectionPool,Kraken\Channel\Model\Socket\Connection $connectionPool
return Kraken\Channel\Model\Socket\Connection\ConnectionPool

$endpoint protected property

protected string $endpoint
return string

$flags protected property

protected string[] $flags
return string[]

$frameBuffer protected property

protected string[] $frameBuffer
return string[]

$hosts protected property

protected string[] $hosts
return string[]

$id protected property

protected string $id
return string

$isConnected protected property

protected bool $isConnected
return boolean

$loop protected property

protected LoopInterface,Kraken\Loop $loop
return Kraken\Loop\LoopInterface

$offlineBuffer protected property

protected Buffer,Kraken\Channel\Model\Socket\Buffer $offlineBuffer
return Kraken\Channel\Model\Socket\Buffer\Buffer

$onlineBuffer protected property

protected Buffer,Kraken\Channel\Model\Socket\Buffer $onlineBuffer
return Kraken\Channel\Model\Socket\Buffer\Buffer

$options protected property

protected mixed[] $options
return mixed[]

$socket protected property

protected SocketInterface,Kraken\Ipc\Socket|SocketListenerInterface,Kraken\Ipc\Socket|null $socket
return Kraken\Ipc\Socket\SocketInterface | Kraken\Ipc\Socket\SocketListenerInterface | null

$type protected property

protected int $type
return integer