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

Commit fb958fb

Browse files
authored
Merge 2.x changes (#1043)
* Resolve conflicts * Apply fixes from StyleCI (#1042)
1 parent c53e78d commit fb958fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2138
-782
lines changed

.github/workflows/ci.yml

+11-29
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,16 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
php:
23-
- '7.3'
24-
- '7.4'
2523
- '8.0'
2624
- '8.1'
2725
laravel:
28-
- 6.*
29-
- 7.*
30-
- 8.*
26+
- 9.*
3127
prefer:
3228
- 'prefer-lowest'
3329
- 'prefer-stable'
3430
include:
35-
- laravel: '6.*'
36-
testbench: '4.*'
37-
phpunit: '^8.5.8|^9.3.3'
38-
- laravel: '7.*'
39-
testbench: '5.*'
40-
phpunit: '^8.5.8|^9.3.3'
41-
- laravel: '8.*'
42-
testbench: '6.*'
43-
phpunit: '^9.3.3'
44-
exclude:
45-
- php: '8.0'
46-
laravel: 6.*
47-
prefer: 'prefer-lowest'
48-
- php: '8.0'
49-
laravel: 7.*
50-
prefer: 'prefer-lowest'
51-
- php: '8.1'
52-
laravel: 6.*
53-
- php: '8.1'
54-
laravel: 7.*
55-
- php: '8.1'
56-
laravel: 8.*
57-
prefer: 'prefer-lowest'
31+
- laravel: '9.*'
32+
testbench: '7.*'
5833

5934
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} --${{ matrix.prefer }}
6035

@@ -68,6 +43,13 @@ jobs:
6843
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
6944
coverage: pcov
7045

46+
- name: Setup MySQL
47+
uses: haltuf/mysql-action@master
48+
with:
49+
mysql version: '8.0'
50+
mysql database: 'websockets_test'
51+
mysql root password: 'password'
52+
7153
- name: Setup Redis
7254
uses: supercharge/[email protected]
7355
with:
@@ -81,7 +63,7 @@ jobs:
8163

8264
- name: Install dependencies
8365
run: |
84-
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench-browser-kit:${{ matrix.testbench }}" "orchestra/database:${{ matrix.testbench }}" --no-interaction --no-update
66+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench-browser-kit:${{ matrix.testbench }}" "orchestra/database:${{ matrix.testbench }}" --no-interaction --no-update
8567
composer update --${{ matrix.prefer }} --prefer-dist --no-interaction --no-suggest
8668
8769
- name: Run tests for Local

composer.json

+22-15
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,33 @@
2929
}
3030
],
3131
"require": {
32-
"cboden/ratchet": "^0.4.1",
33-
"clue/redis-react": "^2.5",
32+
"php": "^8.0|^8.1",
33+
"cboden/ratchet": "^0.4.4",
34+
"clue/block-react": "^1.5",
35+
"clue/reactphp-sqlite": "^1.0",
36+
"clue/redis-react": "^2.6",
37+
"doctrine/dbal": "^2.9",
3438
"evenement/evenement": "^2.0|^3.0",
3539
"facade/ignition-contracts": "^1.0",
36-
"guzzlehttp/psr7": "^1.7|^2.0",
37-
"illuminate/broadcasting": "^6.3|^7.0|^8.0|^9.0",
38-
"illuminate/console": "^6.3|^7.0|^8.0|^9.0",
39-
"illuminate/http": "^6.3|^7.0|^8.0|^9.0",
40-
"illuminate/queue": "^6.3|^7.0|^8.0|^9.0",
41-
"illuminate/routing": "^6.3|^7.0|^8.0|^9.0",
42-
"illuminate/support": "^6.3|^7.0|^8.0|^9.0",
43-
"pusher/pusher-php-server": "^3.0|^4.0|^5.0|^6.0|^7.0",
40+
"guzzlehttp/psr7": "^1.5",
41+
"illuminate/broadcasting": "^9.0",
42+
"illuminate/console": "^9.0",
43+
"illuminate/http": "^9.0",
44+
"illuminate/queue": "^9.0",
45+
"illuminate/routing": "^9.0",
46+
"illuminate/support": "^9.0",
47+
"pusher/pusher-php-server": "^6.0|^7.0",
48+
"react/mysql": "^0.5",
4449
"react/promise": "^2.8",
45-
"symfony/http-kernel": "^4.4|^5.4|^6.0",
50+
"symfony/http-kernel": "^5.0|^6.0",
4651
"symfony/psr-http-message-bridge": "^1.1|^2.0"
4752
},
4853
"require-dev": {
49-
"clue/block-react": "^1.4",
54+
"clue/buzz-react": "^2.9",
5055
"laravel/legacy-factories": "^1.1",
51-
"orchestra/testbench-browser-kit": "^4.0|^5.0|^6.0",
52-
"phpunit/phpunit": "^8.5.8|^9.3.3"
56+
"orchestra/testbench-browser-kit": "^7.0",
57+
"phpunit/phpunit": "^9.0",
58+
"ratchet/pawl": "^0.3.5"
5359
},
5460
"suggest": {
5561
"ext-pcntl": "Running the server needs pcntl to listen to command signals and soft-shutdown.",
@@ -71,7 +77,8 @@
7177
"config": {
7278
"sort-packages": true
7379
},
74-
"minimum-stability": "stable",
80+
"minimum-stability": "dev",
81+
"prefer-stable": true,
7582
"extra": {
7683
"laravel": {
7784
"providers": [

config/websockets.php

+29-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,40 @@
3737
| the use of the TCP protocol based on, for example, a list of allowed
3838
| applications.
3939
| By default, it uses the defined array in the config file, but you can
40-
| anytime implement the same interface as the class and add your own
41-
| custom method to retrieve the apps.
40+
| choose to use SQLite or MySQL application managers, or define a
41+
| custom application manager.
4242
|
4343
*/
4444

4545
'app' => \BeyondCode\LaravelWebSockets\Apps\ConfigAppManager::class,
4646

47+
/*
48+
|--------------------------------------------------------------------------
49+
| SQLite application manager
50+
|--------------------------------------------------------------------------
51+
|
52+
| The SQLite database to use when using the SQLite application manager.
53+
|
54+
*/
55+
56+
'sqlite' => [
57+
'database' => storage_path('laravel-websockets.sqlite'),
58+
],
59+
60+
/*
61+
|--------------------------------------------------------------------------
62+
| MySql application manager
63+
|--------------------------------------------------------------------------
64+
|
65+
| The MySQL database connection to use.
66+
|
67+
*/
68+
69+
'mysql' => [
70+
'connection' => env('DB_CONNECTION', 'mysql'),
71+
72+
'table' => 'websockets_apps',
73+
],
4774
],
4875

4976
/*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateWebSocketsAppsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('websockets_apps', function (Blueprint $table) {
17+
$table->string('id')->index();
18+
$table->string('key');
19+
$table->string('secret');
20+
$table->string('name');
21+
$table->string('host')->nullable();
22+
$table->string('path')->nullable();
23+
$table->boolean('enable_client_messages')->default(false);
24+
$table->boolean('enable_statistics')->default(true);
25+
$table->unsignedInteger('capacity')->nullable();
26+
$table->string('allowed_origins');
27+
$table->nullableTimestamps();
28+
});
29+
}
30+
31+
/**
32+
* Reverse the migrations.
33+
*
34+
* @return void
35+
*/
36+
public function down()
37+
{
38+
Schema::dropIfExists('websockets_apps');
39+
}
40+
}

database/migrations/0000_00_00_000000_create_websockets_statistics_entries_table.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public function up()
1616
Schema::create('websockets_statistics_entries', function (Blueprint $table) {
1717
$table->increments('id');
1818
$table->string('app_id');
19-
$table->integer('peak_connection_count');
20-
$table->integer('websocket_message_count');
21-
$table->integer('api_message_count');
19+
$table->integer('peak_connections_count');
20+
$table->integer('websocket_messages_count');
21+
$table->integer('api_messages_count');
2222
$table->nullableTimestamps();
2323
});
2424
}

database/migrations/0000_00_00_000000_rename_statistics_counters.php

-44
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE IF NOT EXISTS apps (
2+
id STRING NOT NULL,
3+
key STRING NOT NULL,
4+
secret STRING NOT NULL,
5+
name STRING NOT NULL,
6+
host STRING NULLABLE,
7+
path STRING NULLABLE,
8+
enable_client_messages BOOLEAN DEFAULT 0,
9+
enable_statistics BOOLEAN DEFAULT 1,
10+
capacity INTEGER NULLABLE,
11+
allowed_origins STRING NULLABLE
12+
)

0 commit comments

Comments
 (0)