Exemplo n.º 1
0
 public function push($remoteId)
 {
     $remotes = $this->config->getArray('push.remote');
     if (!isset($remotes[$remoteId])) {
         throw new \InvalidArgumentException("Remote 'remote' does not exist");
     }
     $remoteUrl = $remotes[$remoteId]['url'];
     $connections = $this->connectionService->findAll();
     $serializer = SerializerBuilder::create()->build();
     $serializedConnections = $serializer->serialize($connections, 'json');
     $client = new Client();
     $request = $client->createRequest('POST', $remoteUrl, array('Content-Type' => 'application/json', 'User-Agent' => 'JANUS Guzzle HTTP Client (see: https://github.com/janus-ssp/janus)'), $serializedConnections, $this->config->getArray('push.requestOptions'));
     return $request->send()->__toString();
 }