Пример #1
0
 /**
  * Extends socketPrepare() - this method requests the websocket server using
  * polling parameters as default, and handles incrementation on t parameter
  *
  * @param string   $cookie   Cookie to send
  * @param string   $config   Optional - Options to add to standard polling config 
  * @param integer  $request 	1 - POST or 0 - GET
  * @param mixed    $payload  Post fields to send with request, if POST
  *
  * @return string  Socket response
  */
 public function socketRequest($cookie, $config = false, $request = 0, $payload = false)
 {
     // config
     $params = 'EIO=3&transport=polling&t=' . TimeSpan::microstamp() . '-' . $this->_sockTick;
     // extending config
     if (is_string($config)) {
         $params .= '&' . $config;
     }
     // get main host
     $host = str_replace('ws.', '', parse_url($this->_sockLink)['host']);
     // wss request
     $wssResponse = Fetch::getPage($this->_sockLink . '?' . $params, $cookie, $host, $request, $payload);
     // increment ticker
     $this->_sockTick++;
     // return response
     return $wssResponse;
 }
Пример #2
0
 /**
  * Shuts down all running operations
  *
  * @return void
  */
 public function exitOut()
 {
     // Fetch finish
     Fetch::finish();
     // if price update is still running
     if (!$this->_priceUpdate->isJoined()) {
         // stop its operations
         $this->_priceUpdate->stop();
         // wait for thread to finish
         $this->_priceUpdate->join();
     }
 }