Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

[2.x] Extendable hook #465

Merged
merged 1 commit into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion config/websockets.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,32 @@

],

/*
|--------------------------------------------------------------------------
| Route Handlers
|--------------------------------------------------------------------------
|
| Here you can specify the route handlers that will take over
| the incoming/outgoing websocket connections. You can extend the
| original class and implement your own logic, alongside
| with the existing logic.
|
*/

'handlers' => [

'websocket' => \BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler::class,

],

/*
|--------------------------------------------------------------------------
| Broadcasting Replication PubSub
|--------------------------------------------------------------------------
|
| You can enable replication to publish and subscribe to
| messages across the driver.

|
| By default, it is set to 'local', but you can configure it to use drivers
| like Redis to ensure connection between multiple instances of
| WebSocket servers. Just set the driver to 'redis' to enable the PubSub using Redis.
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getRoutes(): RouteCollection

public function echo()
{
$this->get('/app/{appKey}', WebSocketHandler::class);
$this->get('/app/{appKey}', config('websockets.handlers.websocket', WebSocketHandler::class));

$this->post('/apps/{appId}/events', TriggerEventController::class);
$this->get('/apps/{appId}/channels', FetchChannelsController::class);
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use BeyondCode\LaravelWebSockets\Tests\Mocks\Message;
use BeyondCode\LaravelWebSockets\Tests\Statistics\Logger\FakeStatisticsLogger;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
use BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler;
use Clue\React\Buzz\Browser;
use GuzzleHttp\Psr7\Request;
use Mockery;
Expand All @@ -32,7 +31,7 @@ public function setUp(): void
{
parent::setUp();

$this->pusherServer = app(WebSocketHandler::class);
$this->pusherServer = app(config('websockets.handlers.websocket'));

$this->channelManager = app(ChannelManager::class);

Expand Down