Skip to content

Commit 59a5db2

Browse files
committed
api_prefix
1 parent afbf196 commit 59a5db2

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/Client.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function preparePayload(array $arguments): array
136136
*/
137137
private function websocketLoop(Endpoint $endpoint, array $payload): ?Output
138138
{
139-
$ws = $this->ws(self::QUEUE_JOIN);
139+
$ws = $this->ws(str_replace('/', '', $this->config->api_prefix).'/'.self::QUEUE_JOIN);
140140

141141
while (true) {
142142
$data = $ws->receive();
@@ -191,10 +191,10 @@ private function websocketLoop(Endpoint $endpoint, array $payload): ?Output
191191
private function sseLoop(Endpoint $endpoint, array $payload, string $protocol, ?int $triggerId): ?Output
192192
{
193193
if ($protocol === 'sse') {
194-
$getEndpoint = self::QUEUE_JOIN;
194+
$getEndpoint = str_replace('/', '', $this->config->api_prefix).'/'.self::QUEUE_JOIN;
195195
} else {
196-
$getEndpoint = self::SSE_QUEUE_DATA;
197-
$response = $this->httpRaw('post', self::QUEUE_JOIN, [
196+
$getEndpoint = str_replace('/', '', $this->config->api_prefix).'/'.self::SSE_QUEUE_DATA;
197+
$response = $this->httpRaw('post', str_replace('/', '', $this->config->api_prefix).'/'.self::QUEUE_JOIN, [
198198
'data' => $payload,
199199
'fn_index' => $endpoint->index,
200200
'session_hash' => $this->sessionHash,
@@ -239,7 +239,7 @@ private function sseLoop(Endpoint $endpoint, array $payload, string $protocol, ?
239239
$message = $this->hydrator->hydrateWithJson(Message::class, $buffer);
240240

241241
if ($message instanceof SendData && $protocol === 'sse') {
242-
$sendData = $this->httpRaw('post', self::SSE_QUEUE_DATA, [
242+
$sendData = $this->httpRaw('post', str_replace('/', '', $this->config->api_prefix).'/'.self::SSE_QUEUE_DATA, [
243243
'data' => $payload,
244244
'fn_index' => $endpoint->index,
245245
'session_hash' => $this->sessionHash,

src/Client/RemoteClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(string $src, array $httpClientOptions = [])
4343

4444
protected function http(string $method, string $uri, array $params = [], array $opt = [], ?string $dto = null)
4545
{
46+
4647
$response = $this->httpRaw($method, $uri, $params, $opt);
4748

4849
return $this->decodeResponse($response, $dto);

src/DTO/Resolvers/MessageResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#[\Attribute] class MessageResolver extends ConcreteResolver
1818
{
19-
public function concreteFor(array $data): ?string
19+
public function concreteFor(array $data, array $all): ?string
2020
{
2121
$msg = $data['msg'] ?? throw new InvalidArgumentException('Missing msg key');
2222

0 commit comments

Comments
 (0)