Compare commits

..

No commits in common. "master" and "v0.4.1" have entirely different histories.

74 changed files with 246 additions and 344 deletions

View File

@ -1,52 +0,0 @@
name: "CI"
on:
pull_request:
push:
branches:
- "master"
schedule:
- cron: "42 3 * * *"
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
strategy:
matrix:
php-version:
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "5.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit"

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
dist: trusty
matrix:
allow_failures:
- php: hhvm
before_script:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "session.serialize_handler = php" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- php -m
- composer install --dev --prefer-source

View File

@ -8,21 +8,6 @@ CHANGELOG
--- ---
* 0.4.4 (2021-12-11)
* Correct and update dependencies for forward compatibility
* Added context for React Socket server to App
* Use non-deprecated Guzzle API calls
* 0.4.3 (2020-06-04)
* BF: Fixed interface acceptable regression in `App`
* Update RFC6455 library with latest fixes
* 0.4.2 (2020-01-27)
* Support Symfony 5
* BF: Use phpunit from vendor directory
* Allow disabling of xdebug warning by defining `RATCHET_DISABLE_XDEBUG_WARN`
* Stop using `LoopInterface::tick()` for testing
* 0.4.1 (2017-12-11) * 0.4.1 (2017-12-11)
* Only enableKeepAlive in App if no WsServer passed allowing user to set their own timeout duration * Only enableKeepAlive in App if no WsServer passed allowing user to set their own timeout duration
* Support Symfony 4 * Support Symfony 4

View File

@ -1,4 +1,4 @@
Copyright (c) 2011 Chris Boden Copyright (c) 2011-2017 Chris Boden
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -2,10 +2,10 @@
# Users do not need to use `make`; Ratchet does not need to be compiled # Users do not need to use `make`; Ratchet does not need to be compiled
test: test:
vendor/bin/phpunit phpunit
cover: cover:
vendor/bin/phpunit --coverage-text --coverage-html=reports/coverage phpunit --coverage-text --coverage-html=reports/coverage
abtests: abtests:
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8001 LibEvent & ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8001 LibEvent &

View File

@ -1,23 +1,18 @@
# Ratchet # Ratchet
[![GitHub Actions][GA Image]][GA Link] [![Build Status](https://secure.travis-ci.org/ratchetphp/Ratchet.png?branch=master)](http://travis-ci.org/ratchetphp/Ratchet)
[![Autobahn Testsuite](https://img.shields.io/badge/Autobahn-passing-brightgreen.svg)](http://socketo.me/reports/ab/index.html) [![Autobahn Testsuite](https://img.shields.io/badge/Autobahn-passing-brightgreen.svg)](http://socketo.me/reports/ab/index.html)
[![Latest Stable Version](https://poser.pugx.org/cboden/ratchet/v/stable.png)](https://packagist.org/packages/cboden/ratchet) [![Latest Stable Version](https://poser.pugx.org/cboden/ratchet/v/stable.png)](https://packagist.org/packages/cboden/ratchet)
A PHP library for asynchronously serving WebSockets. A PHP library for asynchronously serving WebSockets.
Build up your application through simple interfaces and re-use your application without changing any of its code just by combining different components. Build up your application through simple interfaces and re-use your application without changing any of its code just by combining different components.
## Reviving Ratchet!
We're currently aiming to revive Ratchet to get it up to date with the latest versions and use this as a starting point for bigger updates to come.
We need your help to achieve this goal, see [ticket #1054](https://github.com/ratchetphp/Ratchet/issues/1054) for ways to help out. ❤️
## Requirements ## Requirements
Shell access is required and root access is recommended. Shell access is required and root access is recommended.
To avoid proxy/firewall blockage it's recommended WebSockets are requested on port 80 or 443 (SSL), which requires root access. To avoid proxy/firewall blockage it's recommended WebSockets are requested on port 80 or 443 (SSL), which requires root access.
In order to do this, along with your sync web stack, you can either use a reverse proxy or two separate machines. In order to do this, along with your sync web stack, you can either use a reverse proxy or two separate machines.
You can find more details in the [server conf docs](http://socketo.me/docs/deploy#server_configuration). You can find more details in the [server conf docs](http://socketo.me/docs/deploy#serverconfiguration).
### Documentation ### Documentation
@ -33,8 +28,8 @@ Need help? Have a question? Want to provide feedback? Write a message on the
```php ```php
<?php <?php
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
// Make sure composer dependencies have been installed // Make sure composer dependencies have been installed
require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/vendor/autoload.php';
@ -73,7 +68,7 @@ class MyChat implements MessageComponentInterface {
// Run the server application through the WebSocket protocol on port 8080 // Run the server application through the WebSocket protocol on port 8080
$app = new Ratchet\App('localhost', 8080); $app = new Ratchet\App('localhost', 8080);
$app->route('/chat', new MyChat, array('*')); $app->route('/chat', new MyChat);
$app->route('/echo', new Ratchet\Server\EchoServer, array('*')); $app->route('/echo', new Ratchet\Server\EchoServer, array('*'));
$app->run(); $app->run();
``` ```
@ -86,7 +81,3 @@ class MyChat implements MessageComponentInterface {
conn.onmessage = function(e) { console.log(e.data); }; conn.onmessage = function(e) { console.log(e.data); };
conn.onopen = function(e) { conn.send('Hello Me!'); }; conn.onopen = function(e) { conn.send('Hello Me!'); };
``` ```
[GA Image]: https://github.com/ratchetphp/Ratchet/workflows/CI/badge.svg
[GA Link]: https://github.com/ratchetphp/Ratchet/actions?query=workflow%3A%22CI%22+branch%3Amaster

View File

@ -1,8 +0,0 @@
# Security Policy
## Reporting a Vulnerability
Please report security issues to:
* Chris Boden [cboden@gmail.com](cboden@gmail.com)
* Matt Bonneau [matt@bonneau.net](matt@bonneau.net)

View File

@ -1,5 +1,5 @@
{ {
"name": "mfmdevsystem/mxsocket" "name": "cboden/ratchet"
, "type": "library" , "type": "library"
, "description": "PHP WebSocket library" , "description": "PHP WebSocket library"
, "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"] , "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"]
@ -11,33 +11,24 @@
, "email": "cboden@gmail.com" , "email": "cboden@gmail.com"
, "role": "Developer" , "role": "Developer"
} }
, {
"name": "Matt Bonneau"
, "role": "Developer"
}
, {
"name": "Mohamad Faeez"
, "email": "faeez@maximumbuilders.my"
, "role": "Developer"
}
] ]
, "support": { , "support": {
"issues": "https://github.com/ratchetphp/Ratchet/issues" "forum": "https://groups.google.com/forum/#!forum/ratchet-php"
, "chat": "https://gitter.im/reactphp/reactphp" , "issues": "https://github.com/ratchetphp/Ratchet/issues"
, "irc": "irc://irc.freenode.org/reactphp"
} }
, "autoload": { , "autoload": {
"psr-4": { "psr-4": {
"mfmdevsystem\\socket\\": "src/Socket" "Ratchet\\": "src/Ratchet"
} }
} }
, "require": { , "require": {
"php": ">=8.4.0" "php": ">=5.4.2"
, "mfmdevsystem/rfc6455": "^0.4.2" , "ratchet/rfc6455": "^0.2"
, "react/socket": "^1.0" , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
, "react/event-loop": "^0.4.0" , "guzzlehttp/psr7": "^1.0"
, "guzzlehttp/psr7": "^1.7|^2.0" , "symfony/http-foundation": "^2.6|^3.0|^4.0"
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0" , "symfony/routing": "^2.6|^3.0|^4.0"
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
} }
, "require-dev": { , "require-dev": {
"phpunit/phpunit": "~4.8" "phpunit/phpunit": "~4.8"

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
/** /**
* Wraps ConnectionInterface objects via the decorator pattern but allows * Wraps ConnectionInterface objects via the decorator pattern but allows

View File

@ -1,19 +1,18 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
use React\EventLoop\LoopInterface; use React\EventLoop\LoopInterface;
use React\EventLoop\Factory as LoopFactory; use React\EventLoop\Factory as LoopFactory;
use React\Socket\Server as Reactor; use React\Socket\Server as Reactor;
use React\Socket\SecureServer as SecureReactor; use React\Socket\SecureServer as SecureReactor;
use mfmdevsystem\socket\Http\HttpServerInterface; use Ratchet\Http\HttpServerInterface;
use mfmdevsystem\socket\Http\OriginCheck; use Ratchet\Http\OriginCheck;
use mfmdevsystem\socket\Wamp\WampServerInterface; use Ratchet\Wamp\WampServerInterface;
use mfmdevsystem\socket\Server\IoServer; use Ratchet\Server\IoServer;
use mfmdevsystem\socket\Server\FlashPolicy; use Ratchet\Server\FlashPolicy;
use mfmdevsystem\socket\Http\HttpServer; use Ratchet\Http\HttpServer;
use mfmdevsystem\socket\Http\Router; use Ratchet\Http\Router;
use mfmdevsystem\socket\WebSocket\MessageComponentInterface as WsMessageComponentInterface; use Ratchet\WebSocket\WsServer;
use mfmdevsystem\socket\WebSocket\WsServer; use Ratchet\Wamp\WampServer;
use mfmdevsystem\socket\Wamp\WampServer;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RequestContext;
@ -61,15 +60,9 @@ class App {
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843 * @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine. * @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you. * @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
* @param array $context
*/ */
public function __construct(?string $httpHost = null, ?int $port = null, ?string $address = null, ?LoopInterface $loop = null, ?array $context = null) { public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
if ($httpHost == null) $httpHost = 'localhost'; if (extension_loaded('xdebug')) {
if ($port == null) $port = 80;
if ($address == null) $address = '127.0.0.1';
if ($context == null) $context = array();
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING); trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
} }
@ -80,7 +73,7 @@ class App {
$this->httpHost = $httpHost; $this->httpHost = $httpHost;
$this->port = $port; $this->port = $port;
$socket = new Reactor($address . ':' . $port, $loop, $context); $socket = new Reactor($address . ':' . $port, $loop);
$this->routes = new RouteCollection; $this->routes = new RouteCollection;
$this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop); $this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop);
@ -112,7 +105,7 @@ class App {
} elseif ($controller instanceof WampServerInterface) { } elseif ($controller instanceof WampServerInterface) {
$decorated = new WsServer(new WampServer($controller)); $decorated = new WsServer(new WampServer($controller));
$decorated->enableKeepAlive($this->_server->loop); $decorated->enableKeepAlive($this->_server->loop);
} elseif ($controller instanceof MessageComponentInterface || $controller instanceof WsMessageComponentInterface) { } elseif ($controller instanceof MessageComponentInterface) {
$decorated = new WsServer($controller); $decorated = new WsServer($controller);
$decorated->enableKeepAlive($this->_server->loop); $decorated->enableKeepAlive($this->_server->loop);
} else { } else {

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
/** /**
* This is the interface to build a Ratchet application with. * This is the interface to build a Ratchet application with.

View File

@ -1,11 +1,11 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
/** /**
* The version of socket being used * The version of Ratchet being used
* @var string * @var string
*/ */
const VERSION = 'mfmdevsystem/socket/0.4.9'; const VERSION = 'Ratchet/0.4.1';
/** /**
* A proxy object representing a connection to the application * A proxy object representing a connection to the application

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7\Message; use GuzzleHttp\Psr7 as gPsr;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
trait CloseResponseTrait { trait CloseResponseTrait {
@ -13,10 +13,10 @@ trait CloseResponseTrait {
*/ */
private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) { private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) {
$response = new Response($code, array_merge([ $response = new Response($code, array_merge([
'X-Powered-By' => \mfmdevsystem\socket\VERSION, 'X-Powered-By' => \Ratchet\VERSION
], $additional_headers)); ], $additional_headers));
$conn->send(Message::toString($response)); $conn->send(gPsr\str($response));
$conn->close(); $conn->close();
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\MessageInterface; use Ratchet\MessageInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7\Message; use GuzzleHttp\Psr7 as gPsr;
/** /**
* This class receives streaming data from a client request * This class receives streaming data from a client request
@ -59,6 +59,6 @@ class HttpRequestParser implements MessageInterface {
* @return \Psr\Http\Message\RequestInterface * @return \Psr\Http\Message\RequestInterface
*/ */
public function parse($headers) { public function parse($headers) {
return Message::parseRequest($headers); return gPsr\parse_request($headers);
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
class HttpServer implements MessageComponentInterface { class HttpServer implements MessageComponentInterface {
use CloseResponseTrait; use CloseResponseTrait;

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
interface HttpServerInterface extends MessageComponentInterface { interface HttpServerInterface extends MessageComponentInterface {
@ -10,5 +10,5 @@ interface HttpServerInterface extends MessageComponentInterface {
* @param \Psr\Http\Message\RequestInterface $request null is default because PHP won't let me overload; don't pass null!!! * @param \Psr\Http\Message\RequestInterface $request null is default because PHP won't let me overload; don't pass null!!!
* @throws \UnexpectedValueException if a RequestInterface is not passed * @throws \UnexpectedValueException if a RequestInterface is not passed
*/ */
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null); public function onOpen(ConnectionInterface $conn, RequestInterface $request = null);
} }

View File

@ -1,10 +1,10 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
class NoOpHttpServerController implements HttpServerInterface { class NoOpHttpServerController implements HttpServerInterface {
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) { public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
} }
public function onMessage(ConnectionInterface $from, $msg) { public function onMessage(ConnectionInterface $from, $msg) {

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
/** /**
@ -31,7 +31,7 @@ class OriginCheck implements HttpServerInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) { public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
$header = (string)$request->getHeader('Origin')[0]; $header = (string)$request->getHeader('Origin')[0];
$origin = parse_url($header, PHP_URL_HOST) ?: $header; $origin = parse_url($header, PHP_URL_HOST) ?: $header;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use GuzzleHttp\Psr7\Query; use GuzzleHttp\Psr7 as gPsr;
class Router implements HttpServerInterface { class Router implements HttpServerInterface {
use CloseResponseTrait; use CloseResponseTrait;
@ -26,7 +26,7 @@ class Router implements HttpServerInterface {
* {@inheritdoc} * {@inheritdoc}
* @throws \UnexpectedValueException If a controller is not \Ratchet\Http\HttpServerInterface * @throws \UnexpectedValueException If a controller is not \Ratchet\Http\HttpServerInterface
*/ */
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) { public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
if (null === $request) { if (null === $request) {
throw new \UnexpectedValueException('$request can not be null'); throw new \UnexpectedValueException('$request can not be null');
} }
@ -61,9 +61,9 @@ class Router implements HttpServerInterface {
$parameters[$key] = $value; $parameters[$key] = $value;
} }
} }
$parameters = array_merge($parameters, Query::parse($uri->getQuery() ?: '')); $parameters = array_merge($parameters, gPsr\parse_query($uri->getQuery() ?: ''));
$request = $request->withUri($uri->withQuery(Query::build($parameters))); $request = $request->withUri($uri->withQuery(gPsr\build_query($parameters)));
$conn->controller = $route['_controller']; $conn->controller = $route['_controller'];
$conn->controller->onOpen($conn, $request); $conn->controller->onOpen($conn, $request);

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
interface MessageComponentInterface extends ComponentInterface, MessageInterface { interface MessageComponentInterface extends ComponentInterface, MessageInterface {
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
interface MessageInterface { interface MessageInterface {
/** /**

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* A simple Ratchet application that will reply to all messages with the message it received * A simple Ratchet application that will reply to all messages with the message it received

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* An app to go on a server stack to pass a policy file to a Flash socket * An app to go on a server stack to pass a policy file to a Flash socket

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use React\Socket\ConnectionInterface as ReactConn; use React\Socket\ConnectionInterface as ReactConn;
/** /**

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use React\EventLoop\LoopInterface; use React\EventLoop\LoopInterface;
use React\Socket\ServerInterface; use React\Socket\ServerInterface;
use React\EventLoop\Factory as LoopFactory; use React\EventLoop\Factory as LoopFactory;
@ -33,7 +33,7 @@ class IoServer {
* @param \React\Socket\ServerInterface $socket The React socket server to run the Ratchet application off of * @param \React\Socket\ServerInterface $socket The React socket server to run the Ratchet application off of
* @param \React\EventLoop\LoopInterface|null $loop The React looper to run the Ratchet application off of * @param \React\EventLoop\LoopInterface|null $loop The React looper to run the Ratchet application off of
*/ */
public function __construct(MessageComponentInterface $app, ServerInterface $socket, ?LoopInterface $loop = null) { public function __construct(MessageComponentInterface $app, ServerInterface $socket, LoopInterface $loop = null) {
if (false === strpos(PHP_VERSION, "hiphop")) { if (false === strpos(PHP_VERSION, "hiphop")) {
gc_enable(); gc_enable();
} }
@ -54,10 +54,7 @@ class IoServer {
* @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any) * @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any)
* @return IoServer * @return IoServer
*/ */
public static function factory(MessageComponentInterface $component, ?int $port = null, ?string $address = null) { public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0') {
if ($port == null) $port = 80;
if ($address == null) $address = '0.0.0.0';
$loop = LoopFactory::create(); $loop = LoopFactory::create();
$socket = new Reactor($address . ':' . $port, $loop); $socket = new Reactor($address . ':' . $port, $loop);

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
class IpBlackList implements MessageComponentInterface { class IpBlackList implements MessageComponentInterface {
/** /**

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Serialize; namespace Ratchet\Session\Serialize;
interface HandlerInterface { interface HandlerInterface {
/** /**

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Serialize; namespace Ratchet\Session\Serialize;
class PhpBinaryHandler implements HandlerInterface { class PhpBinaryHandler implements HandlerInterface {
/** /**

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Serialize; namespace Ratchet\Session\Serialize;
class PhpHandler implements HandlerInterface { class PhpHandler implements HandlerInterface {
/** /**

View File

@ -1,10 +1,10 @@
<?php <?php
namespace mfmdevsystem\socket\Session; namespace Ratchet\Session;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\Http\HttpServerInterface; use Ratchet\Http\HttpServerInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
use mfmdevsystem\socket\Session\Storage\VirtualSessionStorage; use Ratchet\Session\Storage\VirtualSessionStorage;
use mfmdevsystem\socket\Session\Serialize\HandlerInterface; use Ratchet\Session\Serialize\HandlerInterface;
use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
@ -44,9 +44,7 @@ class SessionProvider implements HttpServerInterface {
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer * @param \Ratchet\Session\Serialize\HandlerInterface $serializer
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, ?array $options = null, ?HandlerInterface $serializer = null) { public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null) {
if ($options == null) $options = array();
$this->_app = $app; $this->_app = $app;
$this->_handler = $handler; $this->_handler = $handler;
$this->_null = new NullSessionHandler; $this->_null = new NullSessionHandler;
@ -72,7 +70,7 @@ class SessionProvider implements HttpServerInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) { public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
$sessionName = ini_get('session.name'); $sessionName = ini_get('session.name');
$id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) { $id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) {

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Storage\Proxy; namespace Ratchet\Session\Storage\Proxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
class VirtualProxy extends SessionHandlerProxy { class VirtualProxy extends SessionHandlerProxy {

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Storage; namespace Ratchet\Session\Storage;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use mfmdevsystem\socket\Session\Storage\Proxy\VirtualProxy; use Ratchet\Session\Storage\Proxy\VirtualProxy;
use mfmdevsystem\socket\Session\Serialize\HandlerInterface; use Ratchet\Session\Serialize\HandlerInterface;
class VirtualSessionStorage extends NativeSessionStorage { class VirtualSessionStorage extends NativeSessionStorage {
/** /**

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
class Exception extends \Exception { class Exception extends \Exception {
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
class JsonException extends Exception { class JsonException extends Exception {
public function __construct() { public function __construct() {

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* WebSocket Application Messaging Protocol * WebSocket Application Messaging Protocol

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* A topic/channel containing connections that have subscribed to it * A topic/channel containing connections that have subscribed to it
@ -86,7 +86,6 @@ class Topic implements \IteratorAggregate, \Countable {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function getIterator() { public function getIterator() {
return $this->subscribers; return $this->subscribers;
} }
@ -94,7 +93,6 @@ class Topic implements \IteratorAggregate, \Countable {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function count() { public function count() {
return $this->subscribers->count(); return $this->subscribers->count();
} }

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
class TopicManager implements WsServerInterface, WampServerInterface { class TopicManager implements WsServerInterface, WampServerInterface {
/** /**

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\AbstractConnectionDecorator; use Ratchet\AbstractConnectionDecorator;
use mfmdevsystem\socket\Wamp\ServerProtocol as WAMP; use Ratchet\Wamp\ServerProtocol as WAMP;
/** /**
* A ConnectionInterface object wrapper that is passed to your WAMP application * A ConnectionInterface object wrapper that is passed to your WAMP application
@ -20,7 +20,7 @@ class WampConnection extends AbstractConnectionDecorator {
$this->WAMP->sessionId = str_replace('.', '', uniqid(mt_rand(), true)); $this->WAMP->sessionId = str_replace('.', '', uniqid(mt_rand(), true));
$this->WAMP->prefixes = array(); $this->WAMP->prefixes = array();
$this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \mfmdevsystem\socket\VERSION))); $this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));
} }
/** /**

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* Enable support for the official WAMP sub-protocol in your application * Enable support for the official WAMP sub-protocol in your application

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\ComponentInterface; use Ratchet\ComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
/** /**
* An extension of Ratchet\ComponentInterface to server a WAMP application * An extension of Ratchet\ComponentInterface to server a WAMP application

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket; namespace Ratchet\WebSocket;
use mfmdevsystem\RFC6455\Messaging\MessageBuffer; use Ratchet\RFC6455\Messaging\MessageBuffer;
class ConnContext { class ConnContext {
/** /**
@ -9,7 +9,7 @@ class ConnContext {
public $connection; public $connection;
/** /**
* @var \mfmdevsystem\RFC6455\Messaging\MessageBuffer; * @var \Ratchet\RFC6455\Messaging\MessageBuffer;
*/ */
public $buffer; public $buffer;

View File

@ -0,0 +1,8 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
interface MessageCallableInterface {
public function onMessage(ConnectionInterface $conn, MessageInterface $msg);
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket; namespace Ratchet\WebSocket;
use mfmdevsystem\socket\ComponentInterface; use Ratchet\ComponentInterface;
interface MessageComponentInterface extends ComponentInterface, MessageCallableInterface { interface MessageComponentInterface extends ComponentInterface, MessageCallableInterface {
} }

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket; namespace Ratchet\WebSocket;
use mfmdevsystem\socket\AbstractConnectionDecorator; use Ratchet\AbstractConnectionDecorator;
use mfmdevsystem\RFC6455\Messaging\DataInterface; use Ratchet\RFC6455\Messaging\DataInterface;
use mfmdevsystem\RFC6455\Messaging\Frame; use Ratchet\RFC6455\Messaging\Frame;
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -25,7 +25,7 @@ class WsConnection extends AbstractConnectionDecorator {
} }
/** /**
* @param int|\mfmdevsystem\RFC6455\Messaging\DataInterface * @param int|\Ratchet\RFC6455\Messaging\DataInterface
*/ */
public function close($code = 1000) { public function close($code = 1000) {
if ($this->WebSocket->closing) { if ($this->WebSocket->closing) {

View File

@ -1,20 +1,20 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket; namespace Ratchet\WebSocket;
use mfmdevsystem\socket\ComponentInterface; use Ratchet\ComponentInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\MessageComponentInterface as DataComponentInterface; use Ratchet\MessageComponentInterface as DataComponentInterface;
use mfmdevsystem\socket\Http\HttpServerInterface; use Ratchet\Http\HttpServerInterface;
use mfmdevsystem\socket\Http\CloseResponseTrait; use Ratchet\Http\CloseResponseTrait;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
use mfmdevsystem\RFC6455\Messaging\MessageInterface; use Ratchet\RFC6455\Messaging\MessageInterface;
use mfmdevsystem\RFC6455\Messaging\FrameInterface; use Ratchet\RFC6455\Messaging\FrameInterface;
use mfmdevsystem\RFC6455\Messaging\Frame; use Ratchet\RFC6455\Messaging\Frame;
use mfmdevsystem\RFC6455\Messaging\MessageBuffer; use Ratchet\RFC6455\Messaging\MessageBuffer;
use mfmdevsystem\RFC6455\Messaging\CloseFrameChecker; use Ratchet\RFC6455\Messaging\CloseFrameChecker;
use mfmdevsystem\RFC6455\Handshake\ServerNegotiator; use Ratchet\RFC6455\Handshake\ServerNegotiator;
use mfmdevsystem\RFC6455\Handshake\RequestVerifier; use Ratchet\RFC6455\Handshake\RequestVerifier;
use React\EventLoop\LoopInterface; use React\EventLoop\LoopInterface;
use GuzzleHttp\Psr7\Message; use GuzzleHttp\Psr7 as gPsr;
/** /**
* The adapter to handle WebSocket requests/responses * The adapter to handle WebSocket requests/responses
@ -37,12 +37,12 @@ class WsServer implements HttpServerInterface {
protected $connections; protected $connections;
/** /**
* @var \mfmdevsystem\RFC6455\Messaging\CloseFrameChecker * @var \Ratchet\RFC6455\Messaging\CloseFrameChecker
*/ */
private $closeFrameChecker; private $closeFrameChecker;
/** /**
* @var \mfmdevsystem\RFC6455\Handshake\ServerNegotiator * @var \Ratchet\RFC6455\Handshake\ServerNegotiator
*/ */
private $handshakeNegotiator; private $handshakeNegotiator;
@ -104,7 +104,7 @@ class WsServer implements HttpServerInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) { public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
if (null === $request) { if (null === $request) {
throw new \UnexpectedValueException('$request can not be null'); throw new \UnexpectedValueException('$request can not be null');
} }
@ -114,9 +114,9 @@ class WsServer implements HttpServerInterface {
$conn->WebSocket = new \StdClass; $conn->WebSocket = new \StdClass;
$conn->WebSocket->closing = false; $conn->WebSocket->closing = false;
$response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \mfmdevsystem\socket\VERSION); $response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION);
$conn->send(Message::toString($response)); $conn->send(gPsr\str($response));
if (101 !== $response->getStatusCode()) { if (101 !== $response->getStatusCode()) {
return $conn->close(); return $conn->close();

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket; namespace Ratchet\WebSocket;
/** /**
* WebSocket Server Interface * WebSocket Server Interface

View File

@ -1,8 +0,0 @@
<?php
namespace mfmdevsystem\socket\WebSocket;
use mfmdevsystem\socket\ConnectionInterface;
use mfmdevsystem\RFC6455\Messaging\MessageInterface;
interface MessageCallableInterface {
public function onMessage(ConnectionInterface $conn, MessageInterface $msg);
}

View File

@ -1,10 +1,10 @@
<?php <?php
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
require dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php'; require dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
class BinaryEcho implements \Ratchet\WebSocket\MessageComponentInterface { class BinaryEcho implements \Ratchet\WebSocket\MessageComponentInterface {
public function onMessage(ConnectionInterface $from, \mfmdevsystem\RFC6455\Messaging\MessageInterface $msg) { public function onMessage(ConnectionInterface $from, \Ratchet\RFC6455\Messaging\MessageInterface $msg) {
$from->send($msg); $from->send($msg);
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase { abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase {
protected $_app; protected $_app;

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Mock; namespace Ratchet\Mock;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
class Component implements MessageComponentInterface, WsServerInterface { class Component implements MessageComponentInterface, WsServerInterface {
public $last = array(); public $last = array();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Mock; namespace Ratchet\Mock;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
class Connection implements ConnectionInterface { class Connection implements ConnectionInterface {
public $last = array( public $last = array(

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Mock; namespace Ratchet\Mock;
use mfmdevsystem\socket\AbstractConnectionDecorator; use Ratchet\AbstractConnectionDecorator;
class ConnectionDecorator extends AbstractConnectionDecorator { class ConnectionDecorator extends AbstractConnectionDecorator {
public $last = array( public $last = array(

View File

@ -1,8 +1,8 @@
<?php <?php
namespace mfmdevsystem\socket\Mock; namespace Ratchet\Mock;
use mfmdevsystem\socket\Wamp\WampServerInterface; use Ratchet\Wamp\WampServerInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
class WampComponent implements WampServerInterface, WsServerInterface { class WampComponent implements WampServerInterface, WsServerInterface {
public $last = array(); public $last = array();

View File

@ -1,9 +1,9 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
use mfmdevsystem\socket\ConnectionInterface; use Ratchet\ConnectionInterface;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\Wamp\WampServerInterface; use Ratchet\Wamp\WampServerInterface;
class NullComponent implements MessageComponentInterface, WsServerInterface, WampServerInterface { class NullComponent implements MessageComponentInterface, WsServerInterface, WampServerInterface {
public function onOpen(ConnectionInterface $conn) {} public function onOpen(ConnectionInterface $conn) {}

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp\Stub; namespace Ratchet\Wamp\Stub;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use mfmdevsystem\socket\Wamp\WampServerInterface; use Ratchet\Wamp\WampServerInterface;
interface WsWampServerInterface extends WsServerInterface, WampServerInterface { interface WsWampServerInterface extends WsServerInterface, WampServerInterface {
} }

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\WebSocket\Stub; namespace Ratchet\WebSocket\Stub;
use mfmdevsystem\socket\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface { interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface {
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket; namespace Ratchet;
use mfmdevsystem\socket\Mock\ConnectionDecorator; use Ratchet\Mock\ConnectionDecorator;
/** /**
* @covers Ratchet\AbstractConnectionDecorator * @covers Ratchet\AbstractConnectionDecorator

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
/** /**
* @covers Ratchet\Http\HttpRequestParser * @covers Ratchet\Http\HttpRequestParser

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\AbstractMessageComponentTestCase; use Ratchet\AbstractMessageComponentTestCase;
/** /**
* @covers Ratchet\Http\HttpServer * @covers Ratchet\Http\HttpServer

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\AbstractMessageComponentTestCase; use Ratchet\AbstractMessageComponentTestCase;
/** /**
* @covers Ratchet\Http\OriginCheck * @covers Ratchet\Http\OriginCheck

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Http; namespace Ratchet\Http;
use mfmdevsystem\socket\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RequestContext;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\Server\EchoServer; use Ratchet\Server\EchoServer;
class EchoServerTest extends \PHPUnit_Framework_TestCase { class EchoServerTest extends \PHPUnit_Framework_TestCase {
protected $_conn; protected $_conn;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Application\Server; namespace Ratchet\Application\Server;
use mfmdevsystem\socket\Server\FlashPolicy; use Ratchet\Server\FlashPolicy;
/** /**
* @covers Ratchet\Server\FlashPolicy * @covers Ratchet\Server\FlashPolicy

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Application\Server; namespace Ratchet\Application\Server;
use mfmdevsystem\socket\Server\IoConnection; use Ratchet\Server\IoConnection;
/** /**
* @covers Ratchet\Server\IoConnection * @covers Ratchet\Server\IoConnection

View File

@ -1,8 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\Server\IoServer; use Ratchet\Server\IoServer;
use React\EventLoop\StreamSelectLoop; use React\EventLoop\StreamSelectLoop;
use React\EventLoop\LoopInterface;
use React\Socket\Server; use React\Socket\Server;
/** /**
@ -17,14 +16,6 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
protected $reactor; protected $reactor;
protected function tickLoop(LoopInterface $loop) {
$loop->futureTick(function () use ($loop) {
$loop->stop();
});
$loop->run();
}
public function setUp() { public function setUp() {
$this->app = $this->getMock('\\Ratchet\\MessageComponentInterface'); $this->app = $this->getMock('\\Ratchet\\MessageComponentInterface');
@ -41,7 +32,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
$client = stream_socket_client("tcp://localhost:{$this->port}"); $client = stream_socket_client("tcp://localhost:{$this->port}");
$this->tickLoop($this->server->loop); $this->server->loop->tick();
//$this->assertTrue(is_string($this->app->last['onOpen'][0]->remoteAddress)); //$this->assertTrue(is_string($this->app->last['onOpen'][0]->remoteAddress));
//$this->assertTrue(is_int($this->app->last['onOpen'][0]->resourceId)); //$this->assertTrue(is_int($this->app->last['onOpen'][0]->resourceId));
@ -61,16 +52,16 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
socket_set_block($client); socket_set_block($client);
socket_connect($client, 'localhost', $this->port); socket_connect($client, 'localhost', $this->port);
$this->tickLoop($this->server->loop); $this->server->loop->tick();
socket_write($client, $msg); socket_write($client, $msg);
$this->tickLoop($this->server->loop); $this->server->loop->tick();
socket_shutdown($client, 1); socket_shutdown($client, 1);
socket_shutdown($client, 0); socket_shutdown($client, 0);
socket_close($client); socket_close($client);
$this->tickLoop($this->server->loop); $this->server->loop->tick();
} }
public function testOnClose() { public function testOnClose() {
@ -82,13 +73,13 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
socket_set_block($client); socket_set_block($client);
socket_connect($client, 'localhost', $this->port); socket_connect($client, 'localhost', $this->port);
$this->tickLoop($this->server->loop); $this->server->loop->tick();
socket_shutdown($client, 1); socket_shutdown($client, 1);
socket_shutdown($client, 0); socket_shutdown($client, 0);
socket_close($client); socket_close($client);
$this->tickLoop($this->server->loop); $this->server->loop->tick();
} }
public function testFactory() { public function testFactory() {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Server; namespace Ratchet\Server;
use mfmdevsystem\socket\Server\IpBlackList; use Ratchet\Server\IpBlackList;
/** /**
* @covers Ratchet\Server\IpBlackList * @covers Ratchet\Server\IpBlackList

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Serialize; namespace Ratchet\Session\Serialize;
use mfmdevsystem\socket\Session\Serialize\PhpHandler; use Ratchet\Session\Serialize\PhpHandler;
/** /**
* @covers Ratchet\Session\Serialize\PhpHandler * @covers Ratchet\Session\Serialize\PhpHandler

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Session; namespace Ratchet\Session;
use mfmdevsystem\socket\AbstractMessageComponentTestCase; use Ratchet\AbstractMessageComponentTestCase;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
@ -11,8 +11,6 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
*/ */
class SessionProviderTest extends AbstractMessageComponentTestCase { class SessionProviderTest extends AbstractMessageComponentTestCase {
public function setUp() { public function setUp() {
return $this->markTestIncomplete('Test needs to be updated for ini_set issue in PHP 7.2');
if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) { if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) {
return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed'); return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed');
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Session\Storage; namespace Ratchet\Session\Storage;
use mfmdevsystem\socket\Session\Serialize\PhpHandler; use Ratchet\Session\Serialize\PhpHandler;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;

View File

@ -1,7 +1,7 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\Mock\Connection; use Ratchet\Mock\Connection;
use mfmdevsystem\socket\Mock\WampComponent as TestComponent; use Ratchet\Mock\WampComponent as TestComponent;
/** /**
* @covers \Ratchet\Wamp\ServerProtocol * @covers \Ratchet\Wamp\ServerProtocol

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
/** /**
* @covers Ratchet\Wamp\TopicManager * @covers Ratchet\Wamp\TopicManager

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
/** /**
* @covers Ratchet\Wamp\Topic * @covers Ratchet\Wamp\Topic

View File

@ -1,5 +1,5 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
/** /**
* @covers Ratchet\Wamp\WampConnection * @covers Ratchet\Wamp\WampConnection

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mfmdevsystem\socket\Wamp; namespace Ratchet\Wamp;
use mfmdevsystem\socket\AbstractMessageComponentTestCase; use Ratchet\AbstractMessageComponentTestCase;
/** /**
* @covers Ratchet\Wamp\WampServer * @covers Ratchet\Wamp\WampServer