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 76944dc commit 385c5ab
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 104 deletions.
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "cloudtay/ripple-websocket",
"version": "v0.2",
"license": "MIT",
"authors": [
{
Expand All @@ -10,20 +9,24 @@
],
"autoload": {
"psr-4": {
"Ripple\\App\\WebSocket\\": "src/"
"Ripple\\WebSocket\\": "src/"
}
},
"require": {
"cloudtay/ripple": "^1.0.0",
"cloudtay/ripple-http": "*",
"symfony/http-foundation": "*",
"ext-sockets": "*"
},
"require-dev": {
"ext-posix": "*",
"ext-pcntl": "*",
"ext-curl": "*",
"ext-parallel": "*",
"ext-zlib": "*",
"cloudtay/ripple": "dev-main",
"phpunit/phpunit": "*",
"friendsofphp/php-cs-fixer": "*"
"friendsofphp/php-cs-fixer": "*",
"cloudtay/ripple-http": "dev-main"
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
6 changes: 3 additions & 3 deletions src/Client/Connection.php → src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
* 由于软件或软件的使用或其他交易而引起的任何索赔、损害或其他责任承担责任。
*/

namespace Ripple\App\WebSocket\Client;
namespace Ripple\WebSocket;

use Closure;
use Co\IO;
use Exception;
use Ripple\Socket\SocketStream;
use Ripple\Stream;
use Ripple\Stream\Exception\ConnectionException;
use Ripple\Stream\Stream;
use Ripple\Utils\Output;
use Throwable;

Expand Down Expand Up @@ -69,7 +69,7 @@
* White paper: https://datatracker.ietf.org/doc/html/rfc6455
* Latest specification: https://websockets.spec.whatwg.org/
*/
class Connection
class Client
{
/**
* @var Closure
Expand Down
2 changes: 1 addition & 1 deletion src/Frame/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* 由于软件或软件的使用或其他交易而引起的任何索赔、损害或其他责任承担责任。
*/

namespace Ripple\App\WebSocket\Frame;
namespace Ripple\WebSocket\Frame;

/**
* @Author lidongyooo
Expand Down
2 changes: 1 addition & 1 deletion src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* 由于软件或软件的使用或其他交易而引起的任何索赔、损害或其他责任承担责任。
*/

namespace Ripple\App\WebSocket;
namespace Ripple\WebSocket;

use function extension_loaded;

Expand Down
6 changes: 3 additions & 3 deletions src/Server/Server.php → src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
* 由于软件或软件的使用或其他交易而引起的任何索赔、损害或其他责任承担责任。
*/

namespace Ripple\App\WebSocket\Server;
namespace Ripple\WebSocket;

use Closure;
use Co\IO;
use Ripple\Kernel;
use Ripple\Socket\SocketStream;
use Ripple\Stream\Exception\RuntimeException;
use Ripple\App\WebSocket\Options;
use Ripple\Kernel;
use Ripple\WebSocket\Server\Connection;
use Symfony\Component\HttpFoundation\Request;
use Throwable;

Expand Down
6 changes: 3 additions & 3 deletions src/Server/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
* 由于软件或软件的使用或其他交易而引起的任何索赔、损害或其他责任承担责任。
*/

namespace Ripple\App\WebSocket\Server;
namespace Ripple\WebSocket\Server;

use Closure;
use Ripple\Socket\SocketStream;
use Ripple\Stream\Exception\ConnectionException;
use Ripple\App\WebSocket\Frame\Type;
use Ripple\Utils\Output;
use Ripple\WebSocket\Frame\Type;
use Ripple\WebSocket\Server;
use Symfony\Component\HttpFoundation\Request;
use Throwable;

Expand All @@ -53,7 +54,6 @@
use function explode;
use function inflate_add;
use function inflate_init;
use function is_resource;
use function ord;
use function pack;
use function parse_url;
Expand Down
82 changes: 0 additions & 82 deletions src/WebSocket.php

This file was deleted.

14 changes: 7 additions & 7 deletions tests/WsTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php declare(strict_types=1);


use Co\Net;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Ripple\Coroutine\Promise;
use Ripple\App\WebSocket\Options;
use Ripple\App\WebSocket\Server\Connection;
use Ripple\Promise;
use Ripple\Utils\Output;
use Ripple\WebSocket\Client;
use Ripple\WebSocket\Options;
use Ripple\WebSocket\Server;
use Ripple\WebSocket\Server\Connection;

use function Co\cancelAll;
use function Co\defer;
Expand Down Expand Up @@ -63,7 +63,7 @@ public function test_wsServer(): void
],
]);

$server = Net::WebSocket()->server(
$server = new Server(
'ws://127.0.0.1:8001/',
$context,
new Options(true, true)
Expand All @@ -84,7 +84,7 @@ private function wsTest(): Promise
{
return \Co\promise(function ($r) {
$hash = \md5(\uniqid());
$client = Net::WebSocket()->connect('ws://127.0.0.1:8001/');
$client = new Client('ws://127.0.0.1:8001/');
$client->onOpen(static function () use ($client, $hash) {
\Co\sleep(0.1);
$client->send($hash);
Expand Down

0 comments on commit 385c5ab

Please sign in to comment.