public handleConnect ( Kraken\Ipc\Socket\SocketListenerInterface $server, Kraken\Ipc\Socket\SocketInterface $socket ) | ||
$server | Kraken\Ipc\Socket\SocketListenerInterface | |
$socket | Kraken\Ipc\Socket\SocketInterface |
public function handleConnect($server, $socket)
{
$socket->conn = new NetworkConnection($socket);
try {
$this->component->handleConnect($socket->conn);
$socket->on('data', [$this, 'handleData']);
$socket->on('error', [$this, 'handleError']);
$socket->on('close', [$this, 'handleDisconnect']);
} catch (Error $ex) {
$this->close($socket);
} catch (Exception $ex) {
$this->close($socket);
}
}