/**
* @override
* @inheritDoc
*/
public function start($blockEvent = false)
{
if ($this->isStarted()) {
return false;
}
$connect = $this->connectCallback;
if (!$this->socket->{$connect}($this->endpoint)) {
$this->emit('error', [new ExecutionException('socket not connected.')]);
return false;
}
$this->stopHeartbeat();
$this->stopTimeRegister();
$this->isConnected = true;
$this->startHeartbeat();
$this->startTimeRegister();
$this->connectionPool->erase();
$this->buffer->send();
if (!$blockEvent) {
$this->emit('start');
}
return true;
}