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

Commit 09396cd

Browse files
committed
Merge branch 'master' of github.com:beyondcode/laravel-websockets
2 parents 6d743f7 + a79179c commit 09396cd

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

config/websockets.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
'interval_in_seconds' => 60,
5757
],
5858

59+
/*
60+
* This path will be used to register the necessary routes for the package.
61+
*/
62+
'path' => 'laravel-websockets',
63+
5964
/*
6065
* Define the optional SSL context for your WebSocket connections.
6166
* You can see all available options at: http://php.net/manual/en/context.ssl.php

src/WebSocketsServiceProvider.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public function boot()
3232
}
3333

3434
$this
35-
->registerRouteMacro()
36-
->registerStatisticRoute()
35+
->registerRoutes()
3736
->registerDashboardGate();
3837

3938
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'websockets');
@@ -60,23 +59,16 @@ public function register()
6059
});
6160
}
6261

63-
protected function registerRouteMacro()
62+
protected function registerRoutes()
6463
{
65-
Route::macro('webSockets', function ($prefix = 'laravel-websockets') {
66-
Route::prefix($prefix)->namespace('\\')->middleware(Authorize::class)->group(function () {
64+
Route::prefix(config('websockets.path'))->group(function() {
65+
Route::middleware(Authorize::class)->group(function() {
6766
Route::get('/', ShowDashboard::class);
68-
Route::get('/api/{appId}/statistics', DashboardApiController::class . '@getStatistics');
67+
Route::get('/api/{appId}/statistics', [DashboardApiController::class, 'getStatistics']);
6968
Route::post('auth', AuthenticateDashboard::class);
7069
Route::post('event', SendMessage::class);
7170
});
72-
});
7371

74-
return $this;
75-
}
76-
77-
protected function registerStatisticRoute()
78-
{
79-
Route::prefix('/laravel-websockets')->namespace('\\')->group(function () {
8072
Route::post('statistics', [WebSocketStatisticsEntriesController::class, 'store']);
8173
});
8274

tests/TestCase.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ public function setUp()
2929

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

32-
/** TODO: make this work without middleware prefix */
33-
Route::middleware('App\Http\Controllers')->group(function() {
34-
Route::webSockets();
35-
});
36-
3732
StatisticsLogger::fake();
3833
}
3934

0 commit comments

Comments
 (0)