for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BeyondCode\LaravelWebSockets\Server;
use Exception;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\RequestInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Http\HttpServerInterface;
class HealthHandler implements HttpServerInterface
{
/**
* Handle the socket opening.
*
* @param \Ratchet\ConnectionInterface $connection
* @param \Psr\Http\Message\RequestInterface $request
* @return void
*/
public function onOpen(ConnectionInterface $connection, RequestInterface $request = null)
$response = new Response(
200,
['Content-Type' => 'application/json'],
json_encode(['ok' => true])
);
tap($connection)->send(\GuzzleHttp\Psr7\str($response))->close();
}
* Handle the incoming message.
* @param string $message
public function onMessage(ConnectionInterface $connection, $message)
//
* Handle the websocket close.
public function onClose(ConnectionInterface $connection)
* Handle the websocket errors.
* @param WebSocketException $exception
public function onError(ConnectionInterface $connection, Exception $exception)