Skip to content

Instantly share code, notes, and snippets.

@romainneutron
Created April 5, 2013 11:11
Show Gist options
  • Save romainneutron/5318519 to your computer and use it in GitHub Desktop.
Save romainneutron/5318519 to your computer and use it in GitHub Desktop.
React/stomp heartbeat implementation
<?php
namespace React\Stomp;
class HeartBeatClient implements ClientInterface
{
private $client;
public function __construct(ClientInterface $client, $clientGuarantee, $serverGuarantee)
{
$this->client = $client;
// implement heartbeat stuff here
}
public function connect($timeout = 5)
{
return $this->client->connect($timeout);
}
public function send($destination, $body, array $headers = array())
{
return $this->client->send($destination, $body, $headers);
}
public function subscribe($destination, $callback, array $headers = array())
{
return $this->client->subscribe($destination, $callback, $headers);
}
public function subscribeWithAck($destination, $ack, $callback, array $headers = array())
{
$this->client->subscribeWithAck($destination, $ack, $callback, $headers);
}
public function unsubscribe($subscriptionId, array $headers = array())
{
return $this->client->unsubscribe($subscriptionId, $headers);
}
public function ack($subscriptionId, $messageId, array $headers = array())
{
return $this->client->ack($subscriptionId, $messageId, $headers);
}
public function nack($subscriptionId, $messageId, array $headers = array())
{
return $this->client->nack($subscriptionId, $messageId, $headers);
}
public function disconnect()
{
return $this->client->disconnect();
}
public function isConnected()
{
return $this->client->isConnected();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment