AutobahnTestSuite

Added files to test Ratchet against the AutobahnTestSuite
Bumped version v0.2b
Updated how to handle control frames to run the test suite
This commit is contained in:
Chris Boden 2012-05-20 13:24:37 -04:00
parent 232f28a1bd
commit ff07104316
6 changed files with 50 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<?php
namespace Ratchet;
const VERSION = 'Ratchet/0.1.2';
const VERSION = 'Ratchet/0.2b';
/**
* A proxy object representing a connection to the application

View File

@ -15,8 +15,9 @@ class MessageParser {
$from->WebSocket->frame->addBuffer($data);
if ($from->WebSocket->frame->isCoalesced()) {
if ($from->WebSocket->frame->getOpcode() > 2) {
$from->close();
throw new \UnexpectedValueException('Control frame support coming soon!');
unset($from->WebSocket->frame);
return;
}
// Check frame
// If is control frame, do your thing

View File

@ -0,0 +1,22 @@
<?php
namespace Ratchet\Tests;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class AbFuzzyServer implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $from, $msg) {
$from->send($msg);
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, \Exception $e) {
echo $e->getMessage() . "\n";
$conn->close();
}
}

View File

@ -0,0 +1,11 @@
{
"options": {"failByDrop": false},
"outdir": "../reports/ab",
"servers": [{"agent": "Ratchet/v0.2b", "url": "ws://localhost:8000", "options": {"version": 18}}],
"cases": ["*"],
"exclude-cases": ["9.*"],
"exclude-agent-cases": {}
}

View File

@ -0,0 +1,10 @@
<?php
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use Ratchet\Tests\AbFuzzyServer;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(new WsServer(new AbFuzzyServer), 8000);
$server->run();