public function __construct(LoopInterface $loop, $params)
{
$id = $params['id'];
$endpoint = $params['endpoint'];
$type = $params['type'];
$hosts = $params['host'];
$flags = ['enableHeartbeat' => true, 'enableBuffering' => true, 'enableTimeRegister' => true];
$options = ['bufferSize' => isset($params['bufferSize']) ? (int) $params['bufferSize'] : 0, 'bufferTimeout' => isset($params['bufferTimeout']) ? (int) $params['bufferTimeout'] : 0, 'heartbeatInterval' => isset($params['heartbeatInterval']) ? (int) $params['heartbeatInterval'] : 200, 'heartbeatKeepalive' => isset($params['heartbeatKeepalive']) ? (int) $params['heartbeatKeepalive'] : 1000, 'timeRegisterInterval' => isset($params['timeRegisterInterval']) ? (int) $params['timeRegisterInterval'] : 400];
$this->loop = $loop;
$this->id = $id;
$this->endpoint = $endpoint;
$this->type = $type;
$this->hosts = (array) $hosts;
$this->flags = $flags;
$this->options = $options;
$this->isConnected = false;
$this->hTimer = null;
$this->rTimer = null;
$this->socket = null;
$this->offlineBuffer = $this->getBuffer();
$this->onlineBuffer = $this->getBuffer();
$this->frameBuffer = [];
$this->connectionPool = $this->getConnectionPool();
}