コード例 #1
0
 /**
  * Initialize and set up the transport layer
  *
  * @param Instance $instance
  *
  * @return $this
  */
 public function connect(Instance $instance)
 {
     $this->instance = $instance;
     $this->token = $this->generateToken([$instance->cluster->cluster_id_text, $instance->instance_id_text]);
     $this->resourceUri = Uri::segment([$instance->getProvisionedEndpoint(), $instance->getResourceUri()], false);
     return $this;
 }
コード例 #2
0
 /**
  * Initialize and set up the transport layer
  *
  * @param Instance    $instance
  * @param string|null $token  The token to use instead of automatic one
  * @param string|null $header The HTTP header to use instead of DFE one
  *
  * @return $this
  */
 public function connect(Instance $instance, $token = null, $header = null)
 {
     $this->instance = $instance;
     //  Note trailing slash added...
     $this->resourceUri = rtrim(Uri::segment([$instance->getProvisionedEndpoint(), $instance->getResourceUri()], false), '/') . '/';
     //  Set up the channel
     $this->token = $token ?: $this->generateToken([$instance->cluster->cluster_id_text, $instance->instance_id_text]);
     $this->headers = [$header ?: EnterpriseDefaults::CONSOLE_X_HEADER . ': ' . $this->token];
     return $this;
 }