Skip to content

Commit

Permalink
pre-release: v1.0.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
cclilshy committed Oct 31, 2024
1 parent 6bc1ebd commit c530743
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 320 deletions.
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "cloudtay/ripple-driver",
"version": "dev-main",
"license": "MIT",
"autoload": {
"psr-4": {
Expand All @@ -23,7 +22,9 @@
"ext-posix": "*",
"ext-sockets": "*",
"ext-pdo": "*",
"cloudtay/ripple": "*"
"cloudtay/ripple": "^1.0.0",
"cloudtay/ripple-http": "dev-main",
"cloudtay/ripple-websocket": "dev-main"
},
"require-dev": {
"amphp/mysql": "^3.0",
Expand All @@ -38,10 +39,8 @@
"topthink/framework": "*",
"workerman/workerman": "*",
"workerman/webman-framework": "dev-master",
"yiisoft/yii2": "^2.0@beta",
"cloudtay/ripple": "dev-main",
"cloudtay/ripple-http": "dev-main",
"cloudtay/ripple-websocket": "dev-main"
"yiisoft/yii2": "^2.0@beta"

},
"extra": {
"laravel": {
Expand Down
35 changes: 0 additions & 35 deletions example/fifo.php

This file was deleted.

36 changes: 0 additions & 36 deletions example/output.php

This file was deleted.

113 changes: 0 additions & 113 deletions example/worker.php

This file was deleted.

4 changes: 2 additions & 2 deletions example/workerman4.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

include_once __DIR__ . '/../vendor/autoload.php';

use Ripple\Drive\Workerman\Driver4;
use Ripple\Driver\Workerman\Driver4;
use Ripple\Utils\Output;
use Workerman\Timer;
use Workerman\Worker;
Expand Down Expand Up @@ -73,7 +73,7 @@

//使用原生guzzle实现异步请求
try {
$response = Co\Plugin::Guzzle()->newClient()->get('https://www.baidu.com/');
$response = \Ripple\Http\Guzzle::newClient()->get('https://www.baidu.com/');
\var_dump($response->getStatusCode());
$connection->send("[async] Response status code: {$response->getStatusCode()}" . \PHP_EOL);
} catch (Throwable $exception) {
Expand Down
5 changes: 2 additions & 3 deletions example/workerman5.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

include_once __DIR__ . '/../vendor/autoload.php';

use Ripple\Drive\Workerman\Driver5;
use Ripple\Driver\Workerman\Driver5;
use Ripple\Utils\Output;
use Workerman\Timer;
use Workerman\Worker;
Expand Down Expand Up @@ -73,15 +73,14 @@

//使用原生guzzle实现异步请求
try {
$response = Co\Plugin::Guzzle()->newClient()->get('https://www.baidu.com/');
$response = \Ripple\Http\Guzzle::newClient()->get('https://www.baidu.com/');
\var_dump($response->getStatusCode());
$connection->send("[async] Response status code: {$response->getStatusCode()}" . \PHP_EOL);
} catch (Throwable $exception) {
$connection->send("[async] Exception: {$exception->getMessage()}" . \PHP_EOL);

}


$connection->send("say {$data}");
};

Expand Down
7 changes: 4 additions & 3 deletions src/Laravel/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Ripple\Stream\Exception\ConnectionException;
use Ripple\Stream\Stream;
use Revolt\EventLoop\UnsupportedFeatureException;
use Ripple\Kernel;
use Ripple\Stream;
use Ripple\Stream\Exception\ConnectionException;
use Ripple\Utils\Output;
use Ripple\Utils\Serialization\Zx7e;
use Ripple\Worker\Manager;
use Revolt\EventLoop\UnsupportedFeatureException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down Expand Up @@ -115,6 +115,7 @@ class Driver extends Command
* @param OutputInterface $output
*
* @return void
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function initialize(InputInterface $input, OutputInterface $output): void
{
Expand Down
15 changes: 4 additions & 11 deletions src/Laravel/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@
namespace Ripple\Driver\Laravel;

use Co\IO;
use Co\Net;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Config;
use Ripple\App\Http\Server\Request;
use Ripple\App\Http\Server\Server;
use Ripple\Driver\Laravel\Events\RequestHandled;
use Ripple\Driver\Laravel\Events\RequestReceived;
use Ripple\Driver\Laravel\Events\RequestTerminated;
Expand All @@ -49,7 +46,8 @@
use Ripple\Driver\Laravel\Traits\DispatchesEvents;
use Ripple\Driver\Utils\Console;
use Ripple\Driver\Utils\Guard;
use Ripple\Utils\Output;
use Ripple\Http\Server;
use Ripple\Http\Server\Request;
use Ripple\Worker\Manager;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Throwable;
Expand All @@ -66,7 +64,7 @@
* @Author cclilshy
* @Date 2024/8/16 23:38
*/
class Worker extends \Ripple\Worker\Worker
class Worker extends \Ripple\Worker
{
use Console;
use DispatchesEvents;
Expand Down Expand Up @@ -119,18 +117,13 @@ public function register(Manager $manager): void
/*** output logs*/
fwrite(STDOUT, $this->formatRow(["- Logs"]));

$server = Net::Http()->server($this->address, [
$server = new Server($this->address, [
'socket' => [
'so_reuseport' => 1,
'so_reuseaddr' => 1
]
]);

if (!$server) {
Output::error('Server not supported');
exit(1);
}

$this->server = $server;
$this->application = Application::getInstance();

Expand Down
Loading

0 comments on commit c530743

Please sign in to comment.