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

Commit 279dd62

Browse files
committed
Merge branch '2.x' of github.com:beyondcode/laravel-websockets into refactor/tests
2 parents 4e9b526 + 8e6ca73 commit 279dd62

File tree

12 files changed

+38
-40
lines changed

12 files changed

+38
-40
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ jobs:
1010
matrix:
1111
os: [ubuntu-latest, windows-latest]
1212
php: [7.4, 7.3, 7.2]
13-
laravel: [5.8.*, 6.*, 7.*]
13+
laravel: [6.*, 7.*]
1414
dependency-version: [prefer-lowest, prefer-stable]
1515
include:
1616
- laravel: 7.*
1717
testbench: 5.*
1818
- laravel: 6.*
1919
testbench: 4.*
20-
- laravel: 5.8.*
21-
testbench: 3.8.*
2220

2321
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
2422

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"clue/redis-react": "^2.3",
3030
"facade/ignition-contracts": "^1.0",
3131
"guzzlehttp/psr7": "^1.5",
32-
"illuminate/broadcasting": "5.8.*|^6.0|^7.0",
33-
"illuminate/console": "5.8.*|^6.0|^7.0",
34-
"illuminate/http": "5.8.*|^6.0|^7.0",
35-
"illuminate/routing": "5.8.*|^6.0|^7.0",
36-
"illuminate/support": "5.8.*|^6.0|^7.0",
32+
"illuminate/broadcasting": "^6.0|^7.0",
33+
"illuminate/console": "^6.0|^7.0",
34+
"illuminate/http": "^6.0|^7.0",
35+
"illuminate/routing": "^6.0|^7.0",
36+
"illuminate/support": "^6.0|^7.0",
3737
"pusher/pusher-php-server": "^3.0|^4.0",
3838
"react/dns": "^1.1",
3939
"symfony/http-kernel": "^4.0|^5.0",

config/websockets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
|
4141
*/
4242

43-
'app' => \BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class,
43+
'app' => \BeyondCode\LaravelWebSockets\Apps\ConfigAppManager::class,
4444

4545
/*
4646
|--------------------------------------------------------------------------
@@ -195,7 +195,7 @@
195195
|
196196
*/
197197

198-
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class,
198+
'logger' => BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,
199199

200200
/*
201201
|--------------------------------------------------------------------------

resources/views/dashboard.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
wssPort: this.port === null ? 6001 : this.port,
119119
wsPath: this.app.path === null ? '' : this.app.path,
120120
disableStats: true,
121-
authEndpoint: '{{ url('/auth') }}',
121+
authEndpoint: '{{ url(request()->path().'/auth') }}',
122122
auth: {
123123
headers: {
124124
'X-CSRF-Token': "{{ csrf_token() }}",
@@ -162,7 +162,7 @@
162162
},
163163
164164
loadChart() {
165-
$.getJSON('{{ url('/api') }}/' + this.app.id + '/statistics', (data) => {
165+
$.getJSON('{{ url(request()->path().'/api') }}/' + this.app.id + '/statistics', (data) => {
166166
167167
let chartData = [
168168
{
@@ -246,7 +246,7 @@
246246
},
247247
248248
sendEvent() {
249-
$.post('{{ url('/event') }}', {
249+
$.post('{{ url(request()->path().'/event') }}', {
250250
_token: '{{ csrf_token() }}',
251251
key: this.app.key,
252252
secret: this.app.secret,

src/Apps/App.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ class App
3535

3636
public static function findById($appId)
3737
{
38-
return app(AppProvider::class)->findById($appId);
38+
return app(AppManager::class)->findById($appId);
3939
}
4040

4141
public static function findByKey(string $appKey): ?self
4242
{
43-
return app(AppProvider::class)->findByKey($appKey);
43+
return app(AppManager::class)->findByKey($appKey);
4444
}
4545

4646
public static function findBySecret(string $appSecret): ?self
4747
{
48-
return app(AppProvider::class)->findBySecret($appSecret);
48+
return app(AppManager::class)->findBySecret($appSecret);
4949
}
5050

5151
public function __construct($appId, string $appKey, string $appSecret)

src/Apps/AppProvider.php renamed to src/Apps/AppManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace BeyondCode\LaravelWebSockets\Apps;
44

5-
interface AppProvider
5+
interface AppManager
66
{
77
/** @return array[BeyondCode\LaravelWebSockets\AppProviders\App] */
88
public function all(): array;

src/Apps/ConfigAppProvider.php renamed to src/Apps/ConfigAppManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Support\Collection;
66

7-
class ConfigAppProvider implements AppProvider
7+
class ConfigAppManager implements AppManager
88
{
99
/** @var Collection */
1010
protected $apps;
@@ -14,7 +14,7 @@ public function __construct()
1414
$this->apps = collect(config('websockets.apps'));
1515
}
1616

17-
/** @return array[\BeyondCode\LaravelWebSockets\AppProviders\App] */
17+
/** @return array[\BeyondCode\LaravelWebSockets\Apps\App] */
1818
public function all(): array
1919
{
2020
return $this->apps

src/Console/StartWebSocketServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function configureStatisticsLogger()
6969
$browser = new Browser($this->loop, $connector);
7070

7171
$this->laravel->singleton(StatisticsLoggerInterface::class, function () use ($browser) {
72-
$class = config('websockets.statistics.logger', \BeyondCode\LaravelWebSockets\Statistics\Logger::class);
72+
$class = config('websockets.statistics.logger', \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class);
7373

7474
return new $class(
7575
$this->laravel->make(ChannelManager::class),

src/Dashboard/Http/Controllers/ShowDashboard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers;
44

5-
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
5+
use BeyondCode\LaravelWebSockets\Apps\AppManager;
66
use Illuminate\Http\Request;
77

88
class ShowDashboard
99
{
10-
public function __invoke(Request $request, AppProvider $apps)
10+
public function __invoke(Request $request, AppManager $apps)
1111
{
1212
return view('websockets::dashboard', [
1313
'apps' => $apps->all(),

src/Statistics/Rules/AppId.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
namespace BeyondCode\LaravelWebSockets\Statistics\Rules;
44

5-
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
5+
use BeyondCode\LaravelWebSockets\Apps\AppManager;
66
use Illuminate\Contracts\Validation\Rule;
77

88
class AppId implements Rule
99
{
1010
public function passes($attribute, $value)
1111
{
12-
$appProvider = app(AppProvider::class);
12+
$manager = app(AppManager::class);
1313

14-
return $appProvider->findById($value) ? true : false;
14+
return $manager->findById($value) ? true : false;
1515
}
1616

1717
public function message()
1818
{
19-
return 'There is no app registered with the given id. Make sure the websockets config file contains an app for this id or that your custom AppProvider returns an app for this id.';
19+
return 'There is no app registered with the given id. Make sure the websockets config file contains an app for this id or that your custom AppManager returns an app for this id.';
2020
}
2121
}

0 commit comments

Comments
 (0)