[WAMP][BCB] Subscribe protocol compliance

This commit is contained in:
Chris Boden 2012-05-10 23:14:59 -04:00
parent 55e11bac7e
commit 710ec2535f
4 changed files with 11 additions and 9 deletions

View File

@ -2,13 +2,13 @@
#Ratchet #Ratchet
A PHP 5.3 (PSR-0) component library for serving sockets and building socket based applications. A PHP 5.3 (PSR-0) library for serving WebSockets and building socket based applications.
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.
##WebSockets ##WebSockets
* Supports the RFC6455, HyBi-10, and Hixie76 protocol versions (at the same time) * Supports the RFC6455, HyBi-10+, and Hixie76 protocol versions (at the same time)
* Tested on Chrome 18 - 16, Firefox 6 - 8, Safari 5, iOS 4.2, iOS 5 * Tested on Chrome 18 - 16, Firefox 6 - 9, Safari 5, iOS 4.2, iOS 5
##Requirements ##Requirements
@ -31,7 +31,7 @@ See https://github.com/cboden/Ratchet-examples for some out-of-the-box working d
```php ```php
<?php <?php
use Ratchet\MessageInterface; use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface; use Ratchet\ConnectionInterface;
use Ratchet\Server\IoServer; use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer; use Ratchet\WebSocket\WsServer;
@ -40,7 +40,7 @@ use Ratchet\WebSocket\WsServer;
* chat.php * chat.php
* Send any incoming messages to all connected clients (except sender) * Send any incoming messages to all connected clients (except sender)
*/ */
class Chat implements MessageInterface { class Chat implements MessageComponentInterface {
protected $clients; protected $clients;
public function __construct() { public function __construct() {

View File

@ -84,7 +84,6 @@ class WampServer implements WsServerInterface {
switch ($json[0]) { switch ($json[0]) {
case static::MSG_PREFIX: case static::MSG_PREFIX:
$from->WAMP->prefixes[$json[1]] = $json[2]; $from->WAMP->prefixes[$json[1]] = $json[2];
// $from->WAMP->prefixes($json[1], $json[2]);
break; break;
case static::MSG_CALL: case static::MSG_CALL:
@ -108,7 +107,10 @@ class WampServer implements WsServerInterface {
break; break;
case static::MSG_PUBLISH: case static::MSG_PUBLISH:
$this->_decorating->onPublish($from, $from->getUri($json[1]), $json[2]); $exclude = (array_key_exists(3, $json) ? $json[3] : null);
$eligible = (array_key_exists(4, $json) ? $json[4] : null);
$this->_decorating->onPublish($from, $from->getUri($json[1]), $json[2], $exclude, $eligible);
break; break;
default: default:

View File

@ -38,5 +38,5 @@ interface WampServerInterface extends ComponentInterface {
* @param ... * @param ...
* @param string * @param string
*/ */
function onPublish(ConnectionInterface $conn, $uri, $event); function onPublish(ConnectionInterface $conn, $uri, $event, $exclude, $eligible);
} }

View File

@ -18,7 +18,7 @@ class WampComponent implements WampServerInterface {
$this->last[__FUNCTION__] = func_get_args(); $this->last[__FUNCTION__] = func_get_args();
} }
public function onPublish(ConnectionInterface $conn, $uri, $event) { public function onPublish(ConnectionInterface $conn, $uri, $event, $exclude, $eligible) {
$this->last[__FUNCTION__] = func_get_args(); $this->last[__FUNCTION__] = func_get_args();
} }