Kraken\Channel\Model\Socket\Connection\ConnectionPool::getConnection PHP Метод

getConnection() публичный Метод

public getConnection ( string $id ) : Connection
$id string
Результат Connection
    public function getConnection($id)
    {
        return $this->connectionPool[$id]['conn'];
    }

Usage Example

Пример #1
0
 /**
  * @param string $id
  * @param string $data
  * @return bool
  */
 private function writeData($id, $data)
 {
     if ($this->socket === null) {
         return false;
     }
     try {
         if ($this->type === Channel::CONNECTOR) {
             return $this->socket->write($data);
         }
         if ($this->type === Channel::BINDER && $this->connectionPool->existsConnection($id)) {
             return $this->connectionPool->getConnection($id)->getSocket()->write($data);
         }
     } catch (Error $ex) {
         return false;
     } catch (Exception $ex) {
         return false;
     }
     return false;
 }