__construct() public method

public __construct ( resource $resource, Kraken\Loop\LoopInterface $loop, boolean $autoClose = true )
$resource resource
$loop Kraken\Loop\LoopInterface
$autoClose boolean
Example #1
0
 /**
  * @param string|resource $endpointOrResource
  * @param LoopInterface $loop
  * @param mixed[] $config
  * @throws InstantiationException
  */
 public function __construct($endpointOrResource, LoopInterface $loop, $config = [])
 {
     try {
         if (!is_resource($endpointOrResource)) {
             $endpointOrResource = $this->createClient($endpointOrResource, $config);
         }
         parent::__construct($endpointOrResource, $loop);
     } catch (Error $ex) {
         throw new InstantiationException('SocketClient could not be created.');
     } catch (Exception $ex) {
         throw new InstantiationException('SocketClient could not be created.');
     }
 }