public function start($blockEvent = false)
{
if ($this->isStarted()) {
return false;
}
if (!$this->startConnection()) {
$this->emit('error', [new ExecutionException('socket not connected.')]);
return false;
}
$this->stopHeartbeat();
$this->stopTimeRegister();
$this->isConnected = true;
$this->startHeartbeat();
$this->startTimeRegister();
foreach ($messages = $this->offlineBuffer->pull() as $message) {
$this->onlineBuffer->push($message[0], $message[1]);
}
if (!$blockEvent) {
$this->emit('start');
}
return true;
}