|
@@ 133-139 (lines=7) @@
|
| 130 |
|
* |
| 131 |
|
* @return void |
| 132 |
|
*/ |
| 133 |
|
public function request($subject, $payload, $callback, $wait = 1) |
| 134 |
|
{ |
| 135 |
|
$startTime = microtime(true); |
| 136 |
|
$this->connection->request($subject, $payload, $callback, $wait); |
| 137 |
|
$duration = (microtime(true) - $startTime) * 1000; |
| 138 |
|
$this->logger->logCommand('REQUEST: ', $duration, $this->connection, false); |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
/** |
| 142 |
|
* Publish publishes the data argument to the given subject. |
|
@@ 149-155 (lines=7) @@
|
| 146 |
|
* |
| 147 |
|
* @return void |
| 148 |
|
*/ |
| 149 |
|
public function publish($subject, $payload) |
| 150 |
|
{ |
| 151 |
|
$startTime = microtime(true); |
| 152 |
|
$this->connection->publish($subject, $payload); |
| 153 |
|
$duration = (microtime(true) - $startTime) * 1000; |
| 154 |
|
$this->logger->logCommand('PUBLISH: ' . $subject, $duration, $this->connection, false); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
/** |
| 158 |
|
* Subscribes to an specific event given a subject. |
|
@@ 165-172 (lines=8) @@
|
| 162 |
|
* |
| 163 |
|
* @return string |
| 164 |
|
*/ |
| 165 |
|
public function subscribe($subject, \Closure $callback) |
| 166 |
|
{ |
| 167 |
|
$startTime = microtime(true); |
| 168 |
|
$result = $this->connection->subscribe($subject, $callback); |
| 169 |
|
$duration = (microtime(true) - $startTime) * 1000; |
| 170 |
|
$this->logger->logCommand('SUBSCRIBE: ' . $subject, $duration, $this->connection, false); |
| 171 |
|
return $result; |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
/** |
| 175 |
|
* Unsubscribe from a event given a subject. |
|
@@ 181-187 (lines=7) @@
|
| 178 |
|
* |
| 179 |
|
* @return void |
| 180 |
|
*/ |
| 181 |
|
public function unsubscribe($sid) |
| 182 |
|
{ |
| 183 |
|
$startTime = microtime(true); |
| 184 |
|
$this->connection->unsubscribe($sid); |
| 185 |
|
$duration = (microtime(true) - $startTime) * 1000; |
| 186 |
|
$this->logger->logCommand('UNSUBSCRIBE: ' . $sid, $duration, $this->connection, false); |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
/** |
| 190 |
|
* Waits for messages. |