2021-04-06 14:21:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
2025-01-16 07:54:02 +00:00
|
|
|
namespace BlaxSoftware\LaravelWebSockets\Test\Handlers;
|
2021-04-06 14:21:15 +00:00
|
|
|
|
|
|
|
|
use Exception;
|
|
|
|
|
use Ratchet\ConnectionInterface;
|
|
|
|
|
use Ratchet\RFC6455\Messaging\MessageInterface;
|
|
|
|
|
use Ratchet\WebSocket\MessageComponentInterface;
|
|
|
|
|
|
|
|
|
|
class TestHandler implements MessageComponentInterface
|
|
|
|
|
{
|
|
|
|
|
public function onOpen(ConnectionInterface $connection)
|
|
|
|
|
{
|
|
|
|
|
$connection->close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function onClose(ConnectionInterface $connection)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function onError(ConnectionInterface $connection, Exception $e)
|
|
|
|
|
{
|
|
|
|
|
dump($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function onMessage(ConnectionInterface $connection, MessageInterface $msg)
|
|
|
|
|
{
|
|
|
|
|
dump($msg);
|
|
|
|
|
}
|
|
|
|
|
}
|