commit
This commit is contained in:
parent
c90822557b
commit
fe811549a2
|
|
@ -37,9 +37,9 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
* The maximum request size that is allowed for an incoming websocket request.
|
||||
* The maximum request size in bytes that is allowed for an incoming websocket request.
|
||||
*/
|
||||
'maxRequestSize' => 256000,
|
||||
'maxRequestSize' => 1024 * 250,
|
||||
|
||||
/*
|
||||
* Define the optional SSL context for your websocket connections.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use Psr\Http\Message\RequestInterface;
|
|||
|
||||
class OriginCheck implements HttpServerInterface
|
||||
{
|
||||
|
||||
use CloseResponseTrait;
|
||||
|
||||
/** @var \Ratchet\MessageComponentInterface */
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ class Router
|
|||
$this->routes = new RouteCollection;
|
||||
}
|
||||
|
||||
public function getRoutes(): RouteCollection
|
||||
{
|
||||
return $this->routes;
|
||||
}
|
||||
|
||||
public function websocket(string $uri, $action)
|
||||
{
|
||||
if (!is_subclass_of($action, MessageComponentInterface::class)) {
|
||||
|
|
@ -81,13 +86,21 @@ class Router
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param string $action
|
||||
*
|
||||
* @return \Ratchet\WebSocket\WsServer|\Ratchet\Http\HttpServerInterface
|
||||
*/
|
||||
protected function wrapAction($action)
|
||||
protected function wrapAction(string $action)
|
||||
{
|
||||
if (is_subclass_of($action, MessageComponentInterface::class)) {
|
||||
return $this->createWebSocketsServer($action);
|
||||
}
|
||||
|
||||
return app($action);
|
||||
}
|
||||
|
||||
protected function createWebSocketsServer(MessageComponentInterface $action): WsServer
|
||||
{
|
||||
$app = app($action);
|
||||
|
||||
if (MessageLogger::isEnabled()) {
|
||||
|
|
@ -96,12 +109,4 @@ class Router
|
|||
|
||||
return new WsServer($app);
|
||||
}
|
||||
|
||||
return app($action);
|
||||
}
|
||||
|
||||
public function getRoutes(): RouteCollection
|
||||
{
|
||||
return $this->routes;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue