Broadcast client messages to others only
This commit is contained in:
parent
286629fd98
commit
3b2957facd
|
|
@ -42,6 +42,6 @@ class PusherClientMessage implements PusherMessage
|
||||||
|
|
||||||
$channel = $this->channelManager->find($this->connection->app->id, $this->payload->channel);
|
$channel = $this->channelManager->find($this->connection->app->id, $this->payload->channel);
|
||||||
|
|
||||||
optional($channel)->broadcast($this->payload);
|
optional($channel)->broadcastToOthers($this->connection, $this->payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +39,8 @@ class PusherClientMessageTest extends TestCase
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connection = $this->getConnectedWebSocketConnection(['test-channel']);
|
$connection1 = $this->getConnectedWebSocketConnection(['test-channel']);
|
||||||
|
$connection2 = $this->getConnectedWebSocketConnection(['test-channel']);
|
||||||
|
|
||||||
$message = new Message(json_encode([
|
$message = new Message(json_encode([
|
||||||
'event' => 'client-test',
|
'event' => 'client-test',
|
||||||
|
|
@ -49,9 +50,11 @@ class PusherClientMessageTest extends TestCase
|
||||||
],
|
],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$this->pusherServer->onMessage($connection, $message);
|
$this->pusherServer->onMessage($connection1, $message);
|
||||||
|
|
||||||
$connection->assertSentEvent('client-test', [
|
$connection1->assertNotSentEvent('client-test');
|
||||||
|
|
||||||
|
$connection2->assertSentEvent('client-test', [
|
||||||
'data' => [
|
'data' => [
|
||||||
'client-event' => 'test'
|
'client-event' => 'test'
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue