Skip to content

Commit

Permalink
move pusher server (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon authored Dec 4, 2023
1 parent dbd7a98 commit 8a06931
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Server.php → src/Pusher/Server.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace Laravel\Reverb;
namespace Laravel\Reverb\Pusher;

use Exception;
use Illuminate\Support\Str;
use Laravel\Reverb\ClientEvent;
use Laravel\Reverb\Contracts\ChannelManager;
use Laravel\Reverb\Contracts\Connection;
use Laravel\Reverb\Exceptions\InvalidOrigin;
Expand Down
4 changes: 2 additions & 2 deletions src/Servers/ApiGateway/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
use Laravel\Reverb\Contracts\ApplicationProvider;
use Laravel\Reverb\Contracts\ConnectionManager;
use Laravel\Reverb\Exceptions\InvalidApplication;
use Laravel\Reverb\Server as ReverbServer;
use Laravel\Reverb\Pusher\Server as PusherServer;
use Laravel\Reverb\Servers\ApiGateway\Jobs\SendToConnection;

class Server
{
protected ConnectionManager $connections;

public function __construct(
protected ReverbServer $server,
protected PusherServer $server,
protected ApplicationProvider $applications,
) {
$this->connections = app(ConnectionManager::class);
Expand Down
4 changes: 2 additions & 2 deletions src/Servers/Reverb/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Laravel\Reverb\Contracts\ApplicationProvider;
use Laravel\Reverb\Exceptions\InvalidApplication;
use Laravel\Reverb\Server;
use Laravel\Reverb\Pusher\Server as PusherServer;
use Laravel\Reverb\Servers\Reverb\Connection as ReverbConnection;
use Laravel\Reverb\WebSockets\WsConnection;
use Psr\Http\Message\RequestInterface;

class Controller
{
public function __construct(protected Server $server, protected ApplicationProvider $applications)
public function __construct(protected PusherServer $server, protected ApplicationProvider $applications)
{
//
}
Expand Down
4 changes: 2 additions & 2 deletions src/Servers/Reverb/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Laravel\Reverb\Pusher\Http\Controllers\EventsBatchController;
use Laravel\Reverb\Pusher\Http\Controllers\EventsController;
use Laravel\Reverb\Pusher\Http\Controllers\UsersTerminateController;
use Laravel\Reverb\Server;
use Laravel\Reverb\Pusher\Server as PusherServer;
use React\EventLoop\Loop;
use React\EventLoop\LoopInterface;
use React\Socket\SocketServer;
Expand Down Expand Up @@ -42,7 +42,7 @@ protected static function routes(): RouteCollection
{
$routes = new RouteCollection;

$routes->add('sockets', Route::get('/app/{appKey}', new Controller(app(Server::class), app(ApplicationProvider::class))));
$routes->add('sockets', Route::get('/app/{appKey}', new Controller(app(PusherServer::class), app(ApplicationProvider::class))));
$routes->add('events', Route::post('/apps/{appId}/events', new EventsController));
$routes->add('events_batch', Route::post('/apps/{appId}/batch_events', new EventsBatchController));
$routes->add('channels', Route::get('/apps/{appId}/channels', new ChannelsController));
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ServerTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Laravel\Reverb\Contracts\ChannelManager;
use Laravel\Reverb\Server;
use Laravel\Reverb\Pusher\Server;
use Laravel\Reverb\Tests\Connection;
use Laravel\Reverb\Tests\TestCase;

Expand Down

0 comments on commit 8a06931

Please sign in to comment.