Merge pull request #465 from beyondcode/feature/extendable-hook

[2.x] Extendable hook
This commit is contained in:
rennokki 2020-08-17 13:33:48 +03:00 committed by GitHub
commit 9745ca17ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -141,6 +141,24 @@ return [
], ],
/*
|--------------------------------------------------------------------------
| 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 | Broadcasting Replication PubSub
@ -148,7 +166,7 @@ return [
| |
| You can enable replication to publish and subscribe to | You can enable replication to publish and subscribe to
| messages across the driver. | messages across the driver.
|
| By default, it is set to 'local', but you can configure it to use drivers | By default, it is set to 'local', but you can configure it to use drivers
| like Redis to ensure connection between multiple instances of | like Redis to ensure connection between multiple instances of
| WebSocket servers. Just set the driver to 'redis' to enable the PubSub using Redis. | WebSocket servers. Just set the driver to 'redis' to enable the PubSub using Redis.

View File

@ -34,7 +34,7 @@ class Router
public function echo() 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->post('/apps/{appId}/events', TriggerEventController::class);
$this->get('/apps/{appId}/channels', FetchChannelsController::class); $this->get('/apps/{appId}/channels', FetchChannelsController::class);

View File

@ -10,7 +10,6 @@ use BeyondCode\LaravelWebSockets\Tests\Mocks\Connection;
use BeyondCode\LaravelWebSockets\Tests\Mocks\Message; use BeyondCode\LaravelWebSockets\Tests\Mocks\Message;
use BeyondCode\LaravelWebSockets\Tests\Statistics\Logger\FakeStatisticsLogger; use BeyondCode\LaravelWebSockets\Tests\Statistics\Logger\FakeStatisticsLogger;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager; use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
use BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler;
use Clue\React\Buzz\Browser; use Clue\React\Buzz\Browser;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
use Mockery; use Mockery;
@ -32,7 +31,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
{ {
parent::setUp(); parent::setUp();
$this->pusherServer = app(WebSocketHandler::class); $this->pusherServer = app(config('websockets.handlers.websocket'));
$this->channelManager = app(ChannelManager::class); $this->channelManager = app(ChannelManager::class);