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

Merge 2.x changes #1043

Merged
merged 2 commits into from
Oct 6, 2022
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
40 changes: 11 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,16 @@ jobs:
fail-fast: false
matrix:
php:
- '7.3'
- '7.4'
- '8.0'
- '8.1'
laravel:
- 6.*
- 7.*
- 8.*
- 9.*
prefer:
- 'prefer-lowest'
- 'prefer-stable'
include:
- laravel: '6.*'
testbench: '4.*'
phpunit: '^8.5.8|^9.3.3'
- laravel: '7.*'
testbench: '5.*'
phpunit: '^8.5.8|^9.3.3'
- laravel: '8.*'
testbench: '6.*'
phpunit: '^9.3.3'
exclude:
- php: '8.0'
laravel: 6.*
prefer: 'prefer-lowest'
- php: '8.0'
laravel: 7.*
prefer: 'prefer-lowest'
- php: '8.1'
laravel: 6.*
- php: '8.1'
laravel: 7.*
- php: '8.1'
laravel: 8.*
prefer: 'prefer-lowest'
- laravel: '9.*'
testbench: '7.*'

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

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

- name: Setup MySQL
uses: haltuf/mysql-action@master
with:
mysql version: '8.0'
mysql database: 'websockets_test'
mysql root password: 'password'

- name: Setup Redis
uses: supercharge/[email protected]
with:
Expand All @@ -81,7 +63,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench-browser-kit:${{ matrix.testbench }}" "orchestra/database:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench-browser-kit:${{ matrix.testbench }}" "orchestra/database:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.prefer }} --prefer-dist --no-interaction --no-suggest

- name: Run tests for Local
Expand Down
37 changes: 22 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,33 @@
}
],
"require": {
"cboden/ratchet": "^0.4.1",
"clue/redis-react": "^2.5",
"php": "^8.0|^8.1",
"cboden/ratchet": "^0.4.4",
"clue/block-react": "^1.5",
"clue/reactphp-sqlite": "^1.0",
"clue/redis-react": "^2.6",
"doctrine/dbal": "^2.9",
"evenement/evenement": "^2.0|^3.0",
"facade/ignition-contracts": "^1.0",
"guzzlehttp/psr7": "^1.7|^2.0",
"illuminate/broadcasting": "^6.3|^7.0|^8.0|^9.0",
"illuminate/console": "^6.3|^7.0|^8.0|^9.0",
"illuminate/http": "^6.3|^7.0|^8.0|^9.0",
"illuminate/queue": "^6.3|^7.0|^8.0|^9.0",
"illuminate/routing": "^6.3|^7.0|^8.0|^9.0",
"illuminate/support": "^6.3|^7.0|^8.0|^9.0",
"pusher/pusher-php-server": "^3.0|^4.0|^5.0|^6.0|^7.0",
"guzzlehttp/psr7": "^1.5",
"illuminate/broadcasting": "^9.0",
"illuminate/console": "^9.0",
"illuminate/http": "^9.0",
"illuminate/queue": "^9.0",
"illuminate/routing": "^9.0",
"illuminate/support": "^9.0",
"pusher/pusher-php-server": "^6.0|^7.0",
"react/mysql": "^0.5",
"react/promise": "^2.8",
"symfony/http-kernel": "^4.4|^5.4|^6.0",
"symfony/http-kernel": "^5.0|^6.0",
"symfony/psr-http-message-bridge": "^1.1|^2.0"
},
"require-dev": {
"clue/block-react": "^1.4",
"clue/buzz-react": "^2.9",
"laravel/legacy-factories": "^1.1",
"orchestra/testbench-browser-kit": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.5.8|^9.3.3"
"orchestra/testbench-browser-kit": "^7.0",
"phpunit/phpunit": "^9.0",
"ratchet/pawl": "^0.3.5"
},
"suggest": {
"ext-pcntl": "Running the server needs pcntl to listen to command signals and soft-shutdown.",
Expand All @@ -71,7 +77,8 @@
"config": {
"sort-packages": true
},
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
Expand Down
31 changes: 29 additions & 2 deletions config/websockets.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,40 @@
| the use of the TCP protocol based on, for example, a list of allowed
| applications.
| By default, it uses the defined array in the config file, but you can
| anytime implement the same interface as the class and add your own
| custom method to retrieve the apps.
| choose to use SQLite or MySQL application managers, or define a
| custom application manager.
|
*/

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

/*
|--------------------------------------------------------------------------
| SQLite application manager
|--------------------------------------------------------------------------
|
| The SQLite database to use when using the SQLite application manager.
|
*/

'sqlite' => [
'database' => storage_path('laravel-websockets.sqlite'),
],

/*
|--------------------------------------------------------------------------
| MySql application manager
|--------------------------------------------------------------------------
|
| The MySQL database connection to use.
|
*/

'mysql' => [
'connection' => env('DB_CONNECTION', 'mysql'),

'table' => 'websockets_apps',
],
],

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWebSocketsAppsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('websockets_apps', function (Blueprint $table) {
$table->string('id')->index();
$table->string('key');
$table->string('secret');
$table->string('name');
$table->string('host')->nullable();
$table->string('path')->nullable();
$table->boolean('enable_client_messages')->default(false);
$table->boolean('enable_statistics')->default(true);
$table->unsignedInteger('capacity')->nullable();
$table->string('allowed_origins');
$table->nullableTimestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('websockets_apps');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function up()
Schema::create('websockets_statistics_entries', function (Blueprint $table) {
$table->increments('id');
$table->string('app_id');
$table->integer('peak_connection_count');
$table->integer('websocket_message_count');
$table->integer('api_message_count');
$table->integer('peak_connections_count');
$table->integer('websocket_messages_count');
$table->integer('api_messages_count');
$table->nullableTimestamps();
});
}
Expand Down

This file was deleted.

12 changes: 12 additions & 0 deletions database/migrations/sqlite/0000_00_00_000000_create_apps_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS apps (
id STRING NOT NULL,
key STRING NOT NULL,
secret STRING NOT NULL,
name STRING NOT NULL,
host STRING NULLABLE,
path STRING NULLABLE,
enable_client_messages BOOLEAN DEFAULT 0,
enable_statistics BOOLEAN DEFAULT 1,
capacity INTEGER NULLABLE,
allowed_origins STRING NULLABLE
)
Loading