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

[2.x] Asynchronous app managers #644

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
719b83c
Allow asynchronous application managers
mpociot Dec 17, 2020
04a040e
Apply fixes from StyleCI (#642)
mpociot Dec 17, 2020
21fa63f
Remove unneeded test code
mpociot Dec 17, 2020
9335b41
Merge branch 'async-app-managers' of github.com:beyondcode/laravel-we…
mpociot Dec 17, 2020
27b5b03
Apply fixes from StyleCI (#643)
mpociot Dec 17, 2020
4ff393e
Merge branch '2.x' into async-app-managers
mpociot Dec 17, 2020
34f2623
Merge branch 'async-app-managers' of github.com:beyondcode/laravel-we…
mpociot Dec 17, 2020
b6194da
Apply fixes from StyleCI (#645)
mpociot Dec 17, 2020
1f0458c
Fix tests
mpociot Feb 17, 2021
fcb3a53
Apply fixes from StyleCI (#692)
mpociot Feb 17, 2021
5127ef4
Add Async MySQL support
vdauchy May 17, 2021
957744d
Revert to previous DB configuration structure
vdauchy May 18, 2021
936a5bd
Return an empty JSON hash instead of the request JSON. This fixes an …
mpociot Aug 26, 2022
20b45be
Apply fixes from StyleCI (#1023)
mpociot Aug 26, 2022
327e7c7
Fix typo
mpociot Aug 26, 2022
c417124
Update dependencies
mpociot Aug 26, 2022
ec08857
Merge branch '2.x' of github.com:beyondcode/laravel-websockets into 2.x
mpociot Aug 26, 2022
17d0669
bump versions
mpociot Aug 26, 2022
5511d3c
Bump versions
mpociot Aug 26, 2022
e8c718b
Adjust pusher version constraint
mpociot Aug 26, 2022
c1c7519
version bumping
mpociot Aug 26, 2022
7abe196
bump
mpociot Aug 26, 2022
437df8b
wip
mpociot Aug 29, 2022
bf2e76a
Apply fixes from StyleCI (#1027)
mpociot Aug 29, 2022
65a1328
wip
mpociot Aug 29, 2022
8fe62fb
Merge branch 'async-app-managers' of github.com:beyondcode/laravel-we…
mpociot Aug 29, 2022
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
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,16 @@ jobs:
strategy:
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.*'
- laravel: '7.*'
testbench: '5.*'
- laravel: '8.*'
testbench: '6.*'
- laravel: '9.*'
testbench: '7.*'

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

Expand All @@ -48,6 +42,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/redis-github-action@1.1.0
with:
Expand Down
33 changes: 19 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,33 @@
}
],
"require": {
"cboden/ratchet": "^0.4.1",
"clue/redis-react": "^2.3",
"php": "^8.0|^8.1",
"clue/reactphp-sqlite": "^1.0",
"react/mysql": "^0.5",
"cboden/ratchet": "^0.4.4",
"clue/redis-react": "^2.6",
"doctrine/dbal": "^2.9",
"evenement/evenement": "^2.0|^3.0",
"facade/ignition-contracts": "^1.0",
"guzzlehttp/psr7": "^1.5",
"illuminate/broadcasting": "^6.3|^7.0|^8.0",
"illuminate/console": "^6.3|7.0|^8.0",
"illuminate/http": "^6.3|^7.0|^8.0",
"illuminate/queue": "^6.3|^7.0|^8.0",
"illuminate/routing": "^6.3|^7.0|^8.0",
"illuminate/support": "^6.3|^7.0|^8.0",
"pusher/pusher-php-server": "^4.0",
"react/promise": "^2.0",
"symfony/http-kernel": "^4.0|^5.0",
"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/promise": "^2.8",
"symfony/http-kernel": "^5.0|^6.0",
"symfony/psr-http-message-bridge": "^1.1|^2.0"
},
"require-dev": {
"clue/buzz-react": "^2.9",
"clue/block-react": "^1.4",
"laravel/legacy-factories": "^1.1",
"orchestra/testbench-browser-kit": "^4.0|^5.0|^6.0",
"orchestra/database": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.0|^9.0"
"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 @@ -73,6 +77,7 @@
"sort-packages": true
},
"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