Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function register(GloubsterServerInterface $server)
 {
     $component = $this;
     $server['dispatcher']->on('booted', function (GloubsterServerInterface $server) use($component) {
         $server['stomp-client']->subscribeWithAck(sprintf('/queue/%s', RabbitMQConf::QUEUE_LOGS), 'client-individual', Curry::bind(array($component, 'handleLog'), $server['redis-client'], $server['monolog']));
     });
 }
Esempio n. 2
0
 public function addFrame($frame)
 {
     foreach ($this->gifStreams as $gif) {
         $gif->addFrame($frame);
         $gif->lastFrame = $frame;
         $this->loop->addTimer(0.001, Curry::bind([$this, 'resendFrame'], $gif, $frame));
     }
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function register(GloubsterServerInterface $server)
 {
     $server['stomp-client.started'] = false;
     $server['stomp-client'] = $server->share(function (GloubsterServer $server) {
         $factory = new StompFactory($server['loop']);
         return $factory->createClient(array('host' => $server['configuration']['server']['host'], 'port' => $server['configuration']['server']['stomp-gateway']['port'], 'user' => $server['configuration']['server']['user'], 'passcode' => $server['configuration']['server']['password'], 'vhost' => $server['configuration']['server']['vhost']));
     });
     $server['dispatcher']->on('stop', function ($server) {
         $server['stomp-client']->disconnect();
         $server['stomp-client.started'] = false;
         $server['monolog']->addInfo('STOMP Server shutdown');
     });
     $component = $this;
     $server['dispatcher']->on('start', function ($server) use($component) {
         $server['stomp-client']->on('error', array($server, 'logError'));
         $server['stomp-client']->connect()->then(Curry::bind(array($component, 'activateService'), $server), Curry::bind(array($server, 'throwError')));
         $server['monolog']->addInfo('Connecting to STOMP Gateway...');
     });
 }
Esempio n. 4
0
 public function query($domain)
 {
     return $this->resolveWhoisServer($domain)->then(Curry::bind(array($this, 'queryWhoisServer'), $domain));
 }
 public function listBindings($vhost = null)
 {
     if (null !== $vhost) {
         $uri = sprintf('/api/bindings/%s', urlencode($vhost));
     } else {
         $uri = '/api/bindings';
     }
     return $this->executeRequest('GET', $uri)->then(Curry::bind(array($this, 'handleCollectionData'), 'Binding'));
 }
 /**
  * {@inheritdoc}
  */
 public function register(GloubsterServerInterface $server)
 {
     $this->apiClient = AsyncAPIClient::factory($server['loop'], array_merge($server['configuration']['server'], $server['configuration']['server']['server-management']));
     $server['loop']->addPeriodicTimer(5, Curry::bind(array($this, 'fetchMQInformations'), $server['websocket-application'], $server['configuration'], $server['monolog']));
 }
 /**
  * {@inheritdoc}
  */
 public function register(GloubsterServerInterface $server)
 {
     $server['loop']->addPeriodicTimer(0.1, Curry::bind(array($this, 'brodcastServerInformations'), $server['websocket-application']));
     $server['loop']->addPeriodicTimer(5, Curry::bind(array($this, 'displayServerMemory'), $server['monolog']));
 }
Esempio n. 8
0
 public function testBindWithTwoArgs()
 {
     $add = $this->createAddFunction();
     $addOneAndFive = Curry::bind($add, 1, 5);
     $this->assertSame(6, $addOneAndFive());
 }