createFromLoopUnix() public static method

create a sender that sends *everything* through given UNIX socket path
public static createFromLoopUnix ( React\EventLoop\LoopInterface $loop, string $path ) : self
$loop React\EventLoop\LoopInterface
$path string
return self
Ejemplo n.º 1
0
 /**
  * Creates a new Client instance and helps with constructing the right Browser object for the given remote URL
  *
  * @param null|string $url (optional) URL to your (local) Docker daemon, defaults to using local unix domain socket path
  * @return Client
  */
 public function createClient($url = null)
 {
     if ($url === null) {
         $url = 'unix:///var/run/docker.sock';
     }
     $browser = $this->browser;
     if (substr($url, 0, 7) === 'unix://') {
         // send everything through a local unix domain socket
         $browser = $this->browser->withSender(Sender::createFromLoopUnix($this->loop, $url));
         // pretend all HTTP URLs to be on localhost
         $url = 'http://localhost/';
     }
     return new Client($browser->withBase($url));
 }
Ejemplo n.º 2
0
 public function testCreateFromLoopUnix()
 {
     $sender = Sender::createFromLoopUnix($this->loop, 'unix:///run/daemon.sock');
     $this->assertInstanceOf('Clue\\React\\Buzz\\Io\\Sender', $sender);
 }