diff --git a/lib/Ratchet/Exception.php b/lib/Ratchet/Exception.php index a6b7e27..4c1da15 100644 --- a/lib/Ratchet/Exception.php +++ b/lib/Ratchet/Exception.php @@ -2,4 +2,8 @@ namespace Ratchet; class Exception extends \Exception { + public function __construct() { + $int = socket_last_error(); + parent::__construct(socket_strerror($int), $int); + } } \ No newline at end of file diff --git a/lib/Ratchet/Protocol/ProtocolInterface.php b/lib/Ratchet/Protocol/ProtocolInterface.php new file mode 100644 index 0000000..35f0048 --- /dev/null +++ b/lib/Ratchet/Protocol/ProtocolInterface.php @@ -0,0 +1,7 @@ +_server = $server; + } +} \ No newline at end of file diff --git a/lib/Ratchet/Protocol/WebSocket/Version/Hixie76.php b/lib/Ratchet/Protocol/WebSocket/Version/Hixie76.php index 64f93b8..24d55ae 100644 --- a/lib/Ratchet/Protocol/WebSocket/Version/Hixie76.php +++ b/lib/Ratchet/Protocol/WebSocket/Version/Hixie76.php @@ -1,5 +1,20 @@ _master = $socket; + } + + public function run() { } } \ No newline at end of file diff --git a/lib/Ratchet/ServerInterface.php b/lib/Ratchet/ServerInterface.php new file mode 100644 index 0000000..087944d --- /dev/null +++ b/lib/Ratchet/ServerInterface.php @@ -0,0 +1,6 @@ +_socket = socket_open(); + public static $_defaults = Array( + 'domain' => AF_INET + , 'type' => SOCK_STREAM + , 'protocol' => SOL_TCP + ); + + public function __construct($domain = null, $type = null, $protocol = null) { + foreach (static::$_default as $key => $val) { + if (null === $$key) { + $$key = $val; + } + } + + $this->_socket = socket_create($domain, $type, $protocol); } public function __call($method, $arguments) { diff --git a/tests/Ratchet/Tests/Protocol/WebSocket/Version/Hixie76Test.php b/tests/Ratchet/Tests/Protocol/WebSocket/Version/Hixie76Test.php new file mode 100644 index 0000000..b9dffbd --- /dev/null +++ b/tests/Ratchet/Tests/Protocol/WebSocket/Version/Hixie76Test.php @@ -0,0 +1,33 @@ +_version = new Hixie76(); + } + + public function testClassImplementsVersionInterface() { + $constraint = $this->isInstanceOf('\\Ratchet\\Protocol\\WebSocket\\Version\\VersionInterface'); + $this->assertThat($this->_version, $constraint); + } + + /** + * @dataProvider HandshakeProvider + */ + public function INCOMPLETEtestKeySigningForHandshake($key, $accept) { +// $this->assertEquals($accept, $this->_version->sign($key)); + } + + public static function HandshakeProvider() { + return Array( + Array('', '') + , Array('', '') + ); + } +} \ No newline at end of file