This commit is contained in:
Marcel Pociot 2018-11-23 00:24:40 +01:00
parent 10749db211
commit 6e4621cf77
5 changed files with 9 additions and 33 deletions

View File

@ -13,9 +13,18 @@ use Ratchet\Http\HttpServerInterface;
use Psr\Http\Message\RequestInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
use BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager;
abstract class EchoController implements HttpServerInterface
{
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
protected $channelManager;
public function __construct(ChannelManager $channelManager)
{
$this->channelManager = $channelManager;
}
public function onOpen(ConnectionInterface $connection, RequestInterface $request = null)
{
$queryParameters = [];

View File

@ -9,14 +9,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class FetchChannel extends EchoController
{
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
protected $channelManager;
public function __construct(ChannelManager $channelManager)
{
$this->channelManager = $channelManager;
}
public function __invoke(Request $request)
{
$channel = $this->channelManager->find($request->appId, $request->channelName);

View File

@ -11,14 +11,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class FetchChannels extends EchoController
{
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
protected $channelManager;
public function __construct(ChannelManager $channelManager)
{
$this->channelManager = $channelManager;
}
public function __invoke(Request $request)
{
$channels = Collection::make($this->channelManager->getChannels($request->appId))->filter(function ($channel) {

View File

@ -11,14 +11,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class FetchUsers extends EchoController
{
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
protected $channelManager;
public function __construct(ChannelManager $channelManager)
{
$this->channelManager = $channelManager;
}
public function __invoke(Request $request)
{
$channel = $this->channelManager->find($request->appId, $request->channelName);

View File

@ -4,18 +4,9 @@ namespace BeyondCode\LaravelWebSockets\LaravelEcho\Http\Controllers;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
use BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager;
class TriggerEvent extends EchoController
{
/** @var \BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels\ChannelManager */
protected $channelManager;
public function __construct(ChannelManager $channelManager)
{
$this->channelManager = $channelManager;
}
public function __invoke(Request $request)
{
$this->verifySignature($request);