summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Client.php32
-rw-r--r--src/RequestMessage.php2
-rw-r--r--src/WorkerClient.php8
3 files changed, 39 insertions, 3 deletions
diff --git a/src/Client.php b/src/Client.php
index 7f7d663..cb2fb77 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -48,6 +48,38 @@ class Client {
}
/**
+ * @param string[] $targets
+ * @return ResponseMessage
+ * @throws \Exception
+ */
+ public function pause(array $targets = []): ResponseMessage
+ {
+ $data = [];
+ if (!empty($targets))
+ $data['targets'] = $targets;
+
+ return $this->recv(
+ $this->sendRequest(new RequestMessage('pause', $data))
+ );
+ }
+
+ /**
+ * @param string[] $targets
+ * @return ResponseMessage
+ * @throws \Exception
+ */
+ public function continue(array $targets = []): ResponseMessage
+ {
+ $data = [];
+ if (!empty($targets))
+ $data['targets'] = $targets;
+
+ return $this->recv(
+ $this->sendRequest(new RequestMessage('continue', $data))
+ );
+ }
+
+ /**
* @return PongMessage
* @throws \Exception
*/
diff --git a/src/RequestMessage.php b/src/RequestMessage.php
index 7799937..a2e196d 100644
--- a/src/RequestMessage.php
+++ b/src/RequestMessage.php
@@ -49,7 +49,7 @@ class RequestMessage extends Message {
];
if (!is_null($this->requestData))
- $request['data'] = $this->requestData;
+ $request['data'] = (object)$this->requestData;
if (!is_null($this->password))
$request['password'] = $this->password;
diff --git a/src/WorkerClient.php b/src/WorkerClient.php
index 240c200..7650df6 100644
--- a/src/WorkerClient.php
+++ b/src/WorkerClient.php
@@ -25,10 +25,14 @@ class WorkerClient extends Client {
* @return ResponseMessage
* @throws \Exception
*/
- public function poll(array $targets): ResponseMessage
+ public function poll(array $targets = []): ResponseMessage
{
+ $data = [];
+ if (!empty($targets))
+ $data['targets'] = $targets;
+
return $this->recv(
- $this->sendRequest(new RequestMessage('poll', ['targets' => $targets]))
+ $this->sendRequest(new RequestMessage('poll', $data))
);
}