use clientMessagesEnabled
This commit is contained in:
parent
486588c16b
commit
ebd07e6bdb
|
|
@ -34,6 +34,10 @@ class PusherClientMessage implements PusherMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $this->connection->app->clientMessagesEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DashboardLogger::clientMessage($this->connection, $this->payload);
|
DashboardLogger::clientMessage($this->connection, $this->payload);
|
||||||
|
|
||||||
$channel = $this->channelManager->find($this->connection->app->id, $this->payload->channel);
|
$channel = $this->channelManager->find($this->connection->app->id, $this->payload->channel);
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,23 @@ class ChannelTest extends TestCase
|
||||||
$existingConnection->assertSentEvent('client-test');
|
$existingConnection->assertSentEvent('client-test');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function client_messages_will_not_get_broadcasted_to_other_clients_if_client_messages_are_not_enabled()
|
||||||
|
{
|
||||||
|
config()->set('websockets.apps.0.enable_client_messages', false);
|
||||||
|
|
||||||
|
// One connection inside channel "test-channel".
|
||||||
|
$existingConnection = $this->getConnectedWebSocketConnection(['test-channel']);
|
||||||
|
|
||||||
|
$connection = $this->getConnectedWebSocketConnection(['test-channel']);
|
||||||
|
|
||||||
|
$message = new Message('{"event": "client-test", "data": {}, "channel": "test-channel"}');
|
||||||
|
|
||||||
|
$this->pusherServer->onMessage($connection, $message);
|
||||||
|
|
||||||
|
$existingConnection->assertNotSentEvent('client-test');
|
||||||
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function closed_connections_get_removed_from_all_connected_channels()
|
public function closed_connections_get_removed_from_all_connected_channels()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,9 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
'name' => 'Test App',
|
'name' => 'Test App',
|
||||||
'id' => 1234,
|
'id' => 1234,
|
||||||
'key' => 'TestKey',
|
'key' => 'TestKey',
|
||||||
'secret' => 'TestSecret'
|
'secret' => 'TestSecret',
|
||||||
]
|
'enable_client_messages' => true,
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue