PHP Interface Kraken\Network\NetworkComponentInterface

显示文件 Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
handleConnect ( Kraken\Network\NetworkConnectionInterface $conn ) When a new connection is opened it will be passed to this method.
handleDisconnect ( Kraken\Network\NetworkConnectionInterface $conn ) This is called before or after a socket is closed
handleError ( Kraken\Network\NetworkConnectionInterface $conn, Erro\Error | Exceptio\Exception $ex ) If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown, the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method.
handleMessage ( Kraken\Network\NetworkConnectionInterface $conn, Kraken\Network\NetworkMessageInterface $message ) Triggered when a client sends data through the socket.

Method Details

handleConnect() public method

When a new connection is opened it will be passed to this method.
public handleConnect ( Kraken\Network\NetworkConnectionInterface $conn )
$conn Kraken\Network\NetworkConnectionInterface

handleDisconnect() public method

This is called before or after a socket is closed
public handleDisconnect ( Kraken\Network\NetworkConnectionInterface $conn )
$conn Kraken\Network\NetworkConnectionInterface The socket/connection that is closing/closed

handleError() public method

If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown, the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method.
public handleError ( Kraken\Network\NetworkConnectionInterface $conn, Erro\Error | Exceptio\Exception $ex )
$conn Kraken\Network\NetworkConnectionInterface
$ex Erro\Error | Exceptio\Exception

handleMessage() public method

Triggered when a client sends data through the socket.
public handleMessage ( Kraken\Network\NetworkConnectionInterface $conn, Kraken\Network\NetworkMessageInterface $message )
$conn Kraken\Network\NetworkConnectionInterface
$message Kraken\Network\NetworkMessageInterface