Compare commits
No commits in common. "master" and "v0.4.1" have entirely different histories.
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@ -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
20
.travis.yml
Normal 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
|
15
CHANGELOG.md
15
CHANGELOG.md
@ -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)
|
||||
* Only enableKeepAlive in App if no WsServer passed allowing user to set their own timeout duration
|
||||
* Support Symfony 4
|
||||
|
2
LICENSE
2
LICENSE
@ -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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
4
Makefile
4
Makefile
@ -2,10 +2,10 @@
|
||||
# Users do not need to use `make`; Ratchet does not need to be compiled
|
||||
|
||||
test:
|
||||
vendor/bin/phpunit
|
||||
phpunit
|
||||
|
||||
cover:
|
||||
vendor/bin/phpunit --coverage-text --coverage-html=reports/coverage
|
||||
phpunit --coverage-text --coverage-html=reports/coverage
|
||||
|
||||
abtests:
|
||||
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8001 LibEvent &
|
||||
|
19
README.md
19
README.md
@ -1,23 +1,18 @@
|
||||
# Ratchet
|
||||
|
||||
[![GitHub Actions][GA Image]][GA Link]
|
||||
[](http://travis-ci.org/ratchetphp/Ratchet)
|
||||
[](http://socketo.me/reports/ab/index.html)
|
||||
[](https://packagist.org/packages/cboden/ratchet)
|
||||
|
||||
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.
|
||||
|
||||
## 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
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
@ -33,8 +28,8 @@ Need help? Have a question? Want to provide feedback? Write a message on the
|
||||
|
||||
```php
|
||||
<?php
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
// Make sure composer dependencies have been installed
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
@ -73,7 +68,7 @@ class MyChat implements MessageComponentInterface {
|
||||
|
||||
// Run the server application through the WebSocket protocol on port 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->run();
|
||||
```
|
||||
@ -86,7 +81,3 @@ class MyChat implements MessageComponentInterface {
|
||||
conn.onmessage = function(e) { console.log(e.data); };
|
||||
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
|
||||
|
@ -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)
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "mfmdevsystem/mxsocket"
|
||||
"name": "cboden/ratchet"
|
||||
, "type": "library"
|
||||
, "description": "PHP WebSocket library"
|
||||
, "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"]
|
||||
@ -11,33 +11,24 @@
|
||||
, "email": "cboden@gmail.com"
|
||||
, "role": "Developer"
|
||||
}
|
||||
, {
|
||||
"name": "Matt Bonneau"
|
||||
, "role": "Developer"
|
||||
}
|
||||
, {
|
||||
"name": "Mohamad Faeez"
|
||||
, "email": "faeez@maximumbuilders.my"
|
||||
, "role": "Developer"
|
||||
}
|
||||
]
|
||||
, "support": {
|
||||
"issues": "https://github.com/ratchetphp/Ratchet/issues"
|
||||
, "chat": "https://gitter.im/reactphp/reactphp"
|
||||
"forum": "https://groups.google.com/forum/#!forum/ratchet-php"
|
||||
, "issues": "https://github.com/ratchetphp/Ratchet/issues"
|
||||
, "irc": "irc://irc.freenode.org/reactphp"
|
||||
}
|
||||
, "autoload": {
|
||||
"psr-4": {
|
||||
"mfmdevsystem\\socket\\": "src/Socket"
|
||||
"Ratchet\\": "src/Ratchet"
|
||||
}
|
||||
}
|
||||
, "require": {
|
||||
"php": ">=8.4.0"
|
||||
, "mfmdevsystem/rfc6455": "^0.4.2"
|
||||
, "react/socket": "^1.0"
|
||||
, "react/event-loop": "^0.4.0"
|
||||
, "guzzlehttp/psr7": "^1.7|^2.0"
|
||||
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0"
|
||||
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
|
||||
"php": ">=5.4.2"
|
||||
, "ratchet/rfc6455": "^0.2"
|
||||
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
|
||||
, "guzzlehttp/psr7": "^1.0"
|
||||
, "symfony/http-foundation": "^2.6|^3.0|^4.0"
|
||||
, "symfony/routing": "^2.6|^3.0|^4.0"
|
||||
}
|
||||
, "require-dev": {
|
||||
"phpunit/phpunit": "~4.8"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
/**
|
||||
* Wraps ConnectionInterface objects via the decorator pattern but allows
|
@ -1,19 +1,18 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\EventLoop\Factory as LoopFactory;
|
||||
use React\Socket\Server as Reactor;
|
||||
use React\Socket\SecureServer as SecureReactor;
|
||||
use mfmdevsystem\socket\Http\HttpServerInterface;
|
||||
use mfmdevsystem\socket\Http\OriginCheck;
|
||||
use mfmdevsystem\socket\Wamp\WampServerInterface;
|
||||
use mfmdevsystem\socket\Server\IoServer;
|
||||
use mfmdevsystem\socket\Server\FlashPolicy;
|
||||
use mfmdevsystem\socket\Http\HttpServer;
|
||||
use mfmdevsystem\socket\Http\Router;
|
||||
use mfmdevsystem\socket\WebSocket\MessageComponentInterface as WsMessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServer;
|
||||
use mfmdevsystem\socket\Wamp\WampServer;
|
||||
use Ratchet\Http\HttpServerInterface;
|
||||
use Ratchet\Http\OriginCheck;
|
||||
use Ratchet\Wamp\WampServerInterface;
|
||||
use Ratchet\Server\IoServer;
|
||||
use Ratchet\Server\FlashPolicy;
|
||||
use Ratchet\Http\HttpServer;
|
||||
use Ratchet\Http\Router;
|
||||
use Ratchet\WebSocket\WsServer;
|
||||
use Ratchet\Wamp\WampServer;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Routing\Route;
|
||||
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 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 array $context
|
||||
*/
|
||||
public function __construct(?string $httpHost = null, ?int $port = null, ?string $address = null, ?LoopInterface $loop = null, ?array $context = null) {
|
||||
if ($httpHost == null) $httpHost = 'localhost';
|
||||
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) {
|
||||
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
|
||||
if (extension_loaded('xdebug')) {
|
||||
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->port = $port;
|
||||
|
||||
$socket = new Reactor($address . ':' . $port, $loop, $context);
|
||||
$socket = new Reactor($address . ':' . $port, $loop);
|
||||
|
||||
$this->routes = new RouteCollection;
|
||||
$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) {
|
||||
$decorated = new WsServer(new WampServer($controller));
|
||||
$decorated->enableKeepAlive($this->_server->loop);
|
||||
} elseif ($controller instanceof MessageComponentInterface || $controller instanceof WsMessageComponentInterface) {
|
||||
} elseif ($controller instanceof MessageComponentInterface) {
|
||||
$decorated = new WsServer($controller);
|
||||
$decorated->enableKeepAlive($this->_server->loop);
|
||||
} else {
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
/**
|
||||
* This is the interface to build a Ratchet application with.
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
/**
|
||||
* The version of socket being used
|
||||
* The version of Ratchet being used
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = 'mfmdevsystem/socket/0.4.9';
|
||||
const VERSION = 'Ratchet/0.4.1';
|
||||
|
||||
/**
|
||||
* A proxy object representing a connection to the application
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use GuzzleHttp\Psr7\Message;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use GuzzleHttp\Psr7 as gPsr;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
|
||||
trait CloseResponseTrait {
|
||||
@ -13,10 +13,10 @@ trait CloseResponseTrait {
|
||||
*/
|
||||
private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) {
|
||||
$response = new Response($code, array_merge([
|
||||
'X-Powered-By' => \mfmdevsystem\socket\VERSION,
|
||||
'X-Powered-By' => \Ratchet\VERSION
|
||||
], $additional_headers));
|
||||
|
||||
$conn->send(Message::toString($response));
|
||||
$conn->send(gPsr\str($response));
|
||||
$conn->close();
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\MessageInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use GuzzleHttp\Psr7\Message;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\MessageInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use GuzzleHttp\Psr7 as gPsr;
|
||||
|
||||
/**
|
||||
* This class receives streaming data from a client request
|
||||
@ -59,6 +59,6 @@ class HttpRequestParser implements MessageInterface {
|
||||
* @return \Psr\Http\Message\RequestInterface
|
||||
*/
|
||||
public function parse($headers) {
|
||||
return Message::parseRequest($headers);
|
||||
return gPsr\parse_request($headers);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class HttpServer implements MessageComponentInterface {
|
||||
use CloseResponseTrait;
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
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!!!
|
||||
* @throws \UnexpectedValueException if a RequestInterface is not passed
|
||||
*/
|
||||
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null);
|
||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
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) {
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
@ -31,7 +31,7 @@ class OriginCheck implements HttpServerInterface {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
||||
$header = (string)$request->getHeader('Origin')[0];
|
||||
$origin = parse_url($header, PHP_URL_HOST) ?: $header;
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use GuzzleHttp\Psr7\Query;
|
||||
use GuzzleHttp\Psr7 as gPsr;
|
||||
|
||||
class Router implements HttpServerInterface {
|
||||
use CloseResponseTrait;
|
||||
@ -26,7 +26,7 @@ class Router implements HttpServerInterface {
|
||||
* {@inheritdoc}
|
||||
* @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) {
|
||||
throw new \UnexpectedValueException('$request can not be null');
|
||||
}
|
||||
@ -61,9 +61,9 @@ class Router implements HttpServerInterface {
|
||||
$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->onOpen($conn, $request);
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
interface MessageComponentInterface extends ComponentInterface, MessageInterface {
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
interface MessageInterface {
|
||||
/**
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* A simple Ratchet application that will reply to all messages with the message it received
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* An app to go on a server stack to pass a policy file to a Flash socket
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use React\Socket\ConnectionInterface as ReactConn;
|
||||
|
||||
/**
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\Socket\ServerInterface;
|
||||
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\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")) {
|
||||
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)
|
||||
* @return IoServer
|
||||
*/
|
||||
public static function factory(MessageComponentInterface $component, ?int $port = null, ?string $address = null) {
|
||||
if ($port == null) $port = 80;
|
||||
if ($address == null) $address = '0.0.0.0';
|
||||
|
||||
public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0') {
|
||||
$loop = LoopFactory::create();
|
||||
$socket = new Reactor($address . ':' . $port, $loop);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class IpBlackList implements MessageComponentInterface {
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Serialize;
|
||||
namespace Ratchet\Session\Serialize;
|
||||
|
||||
interface HandlerInterface {
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Serialize;
|
||||
namespace Ratchet\Session\Serialize;
|
||||
|
||||
class PhpBinaryHandler implements HandlerInterface {
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Serialize;
|
||||
namespace Ratchet\Session\Serialize;
|
||||
|
||||
class PhpHandler implements HandlerInterface {
|
||||
/**
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\Http\HttpServerInterface;
|
||||
namespace Ratchet\Session;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\Http\HttpServerInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use mfmdevsystem\socket\Session\Storage\VirtualSessionStorage;
|
||||
use mfmdevsystem\socket\Session\Serialize\HandlerInterface;
|
||||
use Ratchet\Session\Storage\VirtualSessionStorage;
|
||||
use Ratchet\Session\Serialize\HandlerInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
|
||||
|
||||
@ -44,9 +44,7 @@ class SessionProvider implements HttpServerInterface {
|
||||
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, ?array $options = null, ?HandlerInterface $serializer = null) {
|
||||
if ($options == null) $options = array();
|
||||
|
||||
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null) {
|
||||
$this->_app = $app;
|
||||
$this->_handler = $handler;
|
||||
$this->_null = new NullSessionHandler;
|
||||
@ -72,7 +70,7 @@ class SessionProvider implements HttpServerInterface {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
||||
$sessionName = ini_get('session.name');
|
||||
|
||||
$id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) {
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Storage\Proxy;
|
||||
namespace Ratchet\Session\Storage\Proxy;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
||||
|
||||
class VirtualProxy extends SessionHandlerProxy {
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Storage;
|
||||
namespace Ratchet\Session\Storage;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
|
||||
use mfmdevsystem\socket\Session\Storage\Proxy\VirtualProxy;
|
||||
use mfmdevsystem\socket\Session\Serialize\HandlerInterface;
|
||||
use Ratchet\Session\Storage\Proxy\VirtualProxy;
|
||||
use Ratchet\Session\Serialize\HandlerInterface;
|
||||
|
||||
class VirtualSessionStorage extends NativeSessionStorage {
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
class Exception extends \Exception {
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
class JsonException extends Exception {
|
||||
public function __construct() {
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* WebSocket Application Messaging Protocol
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* A topic/channel containing connections that have subscribed to it
|
||||
@ -86,7 +86,6 @@ class Topic implements \IteratorAggregate, \Countable {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator() {
|
||||
return $this->subscribers;
|
||||
}
|
||||
@ -94,7 +93,6 @@ class Topic implements \IteratorAggregate, \Countable {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count() {
|
||||
return $this->subscribers->count();
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
|
||||
class TopicManager implements WsServerInterface, WampServerInterface {
|
||||
/**
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\AbstractConnectionDecorator;
|
||||
use mfmdevsystem\socket\Wamp\ServerProtocol as WAMP;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\AbstractConnectionDecorator;
|
||||
use Ratchet\Wamp\ServerProtocol as WAMP;
|
||||
|
||||
/**
|
||||
* 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->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)));
|
||||
}
|
||||
|
||||
/**
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* Enable support for the official WAMP sub-protocol in your application
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\ComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\ComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* An extension of Ratchet\ComponentInterface to server a WAMP application
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket;
|
||||
use mfmdevsystem\RFC6455\Messaging\MessageBuffer;
|
||||
namespace Ratchet\WebSocket;
|
||||
use Ratchet\RFC6455\Messaging\MessageBuffer;
|
||||
|
||||
class ConnContext {
|
||||
/**
|
||||
@ -9,7 +9,7 @@ class ConnContext {
|
||||
public $connection;
|
||||
|
||||
/**
|
||||
* @var \mfmdevsystem\RFC6455\Messaging\MessageBuffer;
|
||||
* @var \Ratchet\RFC6455\Messaging\MessageBuffer;
|
||||
*/
|
||||
public $buffer;
|
||||
|
8
src/Ratchet/WebSocket/MessageCallableInterface.php
Normal file
8
src/Ratchet/WebSocket/MessageCallableInterface.php
Normal 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);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket;
|
||||
use mfmdevsystem\socket\ComponentInterface;
|
||||
namespace Ratchet\WebSocket;
|
||||
use Ratchet\ComponentInterface;
|
||||
|
||||
interface MessageComponentInterface extends ComponentInterface, MessageCallableInterface {
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket;
|
||||
use mfmdevsystem\socket\AbstractConnectionDecorator;
|
||||
use mfmdevsystem\RFC6455\Messaging\DataInterface;
|
||||
use mfmdevsystem\RFC6455\Messaging\Frame;
|
||||
namespace Ratchet\WebSocket;
|
||||
use Ratchet\AbstractConnectionDecorator;
|
||||
use Ratchet\RFC6455\Messaging\DataInterface;
|
||||
use Ratchet\RFC6455\Messaging\Frame;
|
||||
|
||||
/**
|
||||
* {@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) {
|
||||
if ($this->WebSocket->closing) {
|
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket;
|
||||
use mfmdevsystem\socket\ComponentInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\MessageComponentInterface as DataComponentInterface;
|
||||
use mfmdevsystem\socket\Http\HttpServerInterface;
|
||||
use mfmdevsystem\socket\Http\CloseResponseTrait;
|
||||
namespace Ratchet\WebSocket;
|
||||
use Ratchet\ComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\MessageComponentInterface as DataComponentInterface;
|
||||
use Ratchet\Http\HttpServerInterface;
|
||||
use Ratchet\Http\CloseResponseTrait;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use mfmdevsystem\RFC6455\Messaging\MessageInterface;
|
||||
use mfmdevsystem\RFC6455\Messaging\FrameInterface;
|
||||
use mfmdevsystem\RFC6455\Messaging\Frame;
|
||||
use mfmdevsystem\RFC6455\Messaging\MessageBuffer;
|
||||
use mfmdevsystem\RFC6455\Messaging\CloseFrameChecker;
|
||||
use mfmdevsystem\RFC6455\Handshake\ServerNegotiator;
|
||||
use mfmdevsystem\RFC6455\Handshake\RequestVerifier;
|
||||
use Ratchet\RFC6455\Messaging\MessageInterface;
|
||||
use Ratchet\RFC6455\Messaging\FrameInterface;
|
||||
use Ratchet\RFC6455\Messaging\Frame;
|
||||
use Ratchet\RFC6455\Messaging\MessageBuffer;
|
||||
use Ratchet\RFC6455\Messaging\CloseFrameChecker;
|
||||
use Ratchet\RFC6455\Handshake\ServerNegotiator;
|
||||
use Ratchet\RFC6455\Handshake\RequestVerifier;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use GuzzleHttp\Psr7\Message;
|
||||
use GuzzleHttp\Psr7 as gPsr;
|
||||
|
||||
/**
|
||||
* The adapter to handle WebSocket requests/responses
|
||||
@ -37,12 +37,12 @@ class WsServer implements HttpServerInterface {
|
||||
protected $connections;
|
||||
|
||||
/**
|
||||
* @var \mfmdevsystem\RFC6455\Messaging\CloseFrameChecker
|
||||
* @var \Ratchet\RFC6455\Messaging\CloseFrameChecker
|
||||
*/
|
||||
private $closeFrameChecker;
|
||||
|
||||
/**
|
||||
* @var \mfmdevsystem\RFC6455\Handshake\ServerNegotiator
|
||||
* @var \Ratchet\RFC6455\Handshake\ServerNegotiator
|
||||
*/
|
||||
private $handshakeNegotiator;
|
||||
|
||||
@ -104,7 +104,7 @@ class WsServer implements HttpServerInterface {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
||||
if (null === $request) {
|
||||
throw new \UnexpectedValueException('$request can not be null');
|
||||
}
|
||||
@ -114,9 +114,9 @@ class WsServer implements HttpServerInterface {
|
||||
$conn->WebSocket = new \StdClass;
|
||||
$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()) {
|
||||
return $conn->close();
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket;
|
||||
namespace Ratchet\WebSocket;
|
||||
|
||||
/**
|
||||
* WebSocket Server Interface
|
@ -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);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
require dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
namespace Ratchet;
|
||||
|
||||
abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase {
|
||||
protected $_app;
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Mock;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Mock;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class Component implements MessageComponentInterface, WsServerInterface {
|
||||
public $last = array();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Mock;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Mock;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class Connection implements ConnectionInterface {
|
||||
public $last = array(
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Mock;
|
||||
use mfmdevsystem\socket\AbstractConnectionDecorator;
|
||||
namespace Ratchet\Mock;
|
||||
use Ratchet\AbstractConnectionDecorator;
|
||||
|
||||
class ConnectionDecorator extends AbstractConnectionDecorator {
|
||||
public $last = array(
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Mock;
|
||||
use mfmdevsystem\socket\Wamp\WampServerInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
namespace Ratchet\Mock;
|
||||
use Ratchet\Wamp\WampServerInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class WampComponent implements WampServerInterface, WsServerInterface {
|
||||
public $last = array();
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
use mfmdevsystem\socket\ConnectionInterface;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\Wamp\WampServerInterface;
|
||||
namespace Ratchet;
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\Wamp\WampServerInterface;
|
||||
|
||||
class NullComponent implements MessageComponentInterface, WsServerInterface, WampServerInterface {
|
||||
public function onOpen(ConnectionInterface $conn) {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp\Stub;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
use mfmdevsystem\socket\Wamp\WampServerInterface;
|
||||
namespace Ratchet\Wamp\Stub;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Ratchet\Wamp\WampServerInterface;
|
||||
|
||||
interface WsWampServerInterface extends WsServerInterface, WampServerInterface {
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\WebSocket\Stub;
|
||||
use mfmdevsystem\socket\MessageComponentInterface;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
namespace Ratchet\WebSocket\Stub;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
|
||||
interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface {
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket;
|
||||
use mfmdevsystem\socket\Mock\ConnectionDecorator;
|
||||
namespace Ratchet;
|
||||
use Ratchet\Mock\ConnectionDecorator;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\AbstractConnectionDecorator
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
namespace Ratchet\Http;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Http\HttpRequestParser
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\AbstractMessageComponentTestCase;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\AbstractMessageComponentTestCase;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Http\HttpServer
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\AbstractMessageComponentTestCase;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\AbstractMessageComponentTestCase;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Http\OriginCheck
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Http;
|
||||
use mfmdevsystem\socket\WebSocket\WsServerInterface;
|
||||
namespace Ratchet\Http;
|
||||
use Ratchet\WebSocket\WsServerInterface;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\Server\EchoServer;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\Server\EchoServer;
|
||||
|
||||
class EchoServerTest extends \PHPUnit_Framework_TestCase {
|
||||
protected $_conn;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Application\Server;
|
||||
use mfmdevsystem\socket\Server\FlashPolicy;
|
||||
namespace Ratchet\Application\Server;
|
||||
use Ratchet\Server\FlashPolicy;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Server\FlashPolicy
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Application\Server;
|
||||
use mfmdevsystem\socket\Server\IoConnection;
|
||||
namespace Ratchet\Application\Server;
|
||||
use Ratchet\Server\IoConnection;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Server\IoConnection
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\Server\IoServer;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\Server\IoServer;
|
||||
use React\EventLoop\StreamSelectLoop;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\Socket\Server;
|
||||
|
||||
/**
|
||||
@ -17,14 +16,6 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
protected $reactor;
|
||||
|
||||
protected function tickLoop(LoopInterface $loop) {
|
||||
$loop->futureTick(function () use ($loop) {
|
||||
$loop->stop();
|
||||
});
|
||||
|
||||
$loop->run();
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
$this->app = $this->getMock('\\Ratchet\\MessageComponentInterface');
|
||||
|
||||
@ -41,7 +32,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
$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_int($this->app->last['onOpen'][0]->resourceId));
|
||||
@ -61,16 +52,16 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
|
||||
socket_set_block($client);
|
||||
socket_connect($client, 'localhost', $this->port);
|
||||
|
||||
$this->tickLoop($this->server->loop);
|
||||
$this->server->loop->tick();
|
||||
|
||||
socket_write($client, $msg);
|
||||
$this->tickLoop($this->server->loop);
|
||||
$this->server->loop->tick();
|
||||
|
||||
socket_shutdown($client, 1);
|
||||
socket_shutdown($client, 0);
|
||||
socket_close($client);
|
||||
|
||||
$this->tickLoop($this->server->loop);
|
||||
$this->server->loop->tick();
|
||||
}
|
||||
|
||||
public function testOnClose() {
|
||||
@ -82,13 +73,13 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
|
||||
socket_set_block($client);
|
||||
socket_connect($client, 'localhost', $this->port);
|
||||
|
||||
$this->tickLoop($this->server->loop);
|
||||
$this->server->loop->tick();
|
||||
|
||||
socket_shutdown($client, 1);
|
||||
socket_shutdown($client, 0);
|
||||
socket_close($client);
|
||||
|
||||
$this->tickLoop($this->server->loop);
|
||||
$this->server->loop->tick();
|
||||
}
|
||||
|
||||
public function testFactory() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Server;
|
||||
use mfmdevsystem\socket\Server\IpBlackList;
|
||||
namespace Ratchet\Server;
|
||||
use Ratchet\Server\IpBlackList;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Server\IpBlackList
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Serialize;
|
||||
use mfmdevsystem\socket\Session\Serialize\PhpHandler;
|
||||
namespace Ratchet\Session\Serialize;
|
||||
use Ratchet\Session\Serialize\PhpHandler;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Session\Serialize\PhpHandler
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session;
|
||||
use mfmdevsystem\socket\AbstractMessageComponentTestCase;
|
||||
namespace Ratchet\Session;
|
||||
use Ratchet\AbstractMessageComponentTestCase;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
|
||||
|
||||
@ -11,8 +11,6 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
|
||||
*/
|
||||
class SessionProviderTest extends AbstractMessageComponentTestCase {
|
||||
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')) {
|
||||
return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed');
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Session\Storage;
|
||||
use mfmdevsystem\socket\Session\Serialize\PhpHandler;
|
||||
namespace Ratchet\Session\Storage;
|
||||
use Ratchet\Session\Serialize\PhpHandler;
|
||||
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\Mock\Connection;
|
||||
use mfmdevsystem\socket\Mock\WampComponent as TestComponent;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\Mock\Connection;
|
||||
use Ratchet\Mock\WampComponent as TestComponent;
|
||||
|
||||
/**
|
||||
* @covers \Ratchet\Wamp\ServerProtocol
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Wamp\TopicManager
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Wamp\Topic
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Wamp\WampConnection
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace mfmdevsystem\socket\Wamp;
|
||||
use mfmdevsystem\socket\AbstractMessageComponentTestCase;
|
||||
namespace Ratchet\Wamp;
|
||||
use Ratchet\AbstractMessageComponentTestCase;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Wamp\WampServer
|
||||
|
Loading…
Reference in New Issue
Block a user