public function __construct($url, LoopInterface $loop, LoggerInterface $logger)
{
$uri = new Uri($url);
if ($uri->getScheme() == 'ws') {
$uri->setScheme('tcp');
} elseif ($uri->getScheme() == 'wss') {
$uri->setScheme('ssl');
}
if ($uri->getScheme() != 'tcp' && $uri->getScheme() != 'ssl') {
throw new \InvalidArgumentException("Uri scheme must be one of: tcp, ssl, ws, wss");
}
$this->uri = $uri;
$this->loop = $loop;
$this->_streams = new SplObjectStorage();
$this->_connections = new SplObjectStorage();
$this->_context = stream_context_create();
$this->_logger = $logger;
}