diff --git a/lib/Ratchet/Application/WAMP/App.php b/lib/Ratchet/Application/WAMP/App.php index f97e17b..e0f79d9 100644 --- a/lib/Ratchet/Application/WAMP/App.php +++ b/lib/Ratchet/Application/WAMP/App.php @@ -6,6 +6,7 @@ use Ratchet\Resource\Connection; /** * WebSocket Application Messaging Protocol + * * +--------------+----+------------------+ * | Message Type | ID | DIRECTION | * |--------------+----+------------------+ @@ -63,29 +64,24 @@ class App implements WebSocketAppInterface { break; case 2: - $ret = $this->_app->onCall($from, $json[1], $json[2]); + return $this->_app->onCall($from, $json[1], $json[2]); break; case 5: - $ret = $this->_app->onSubscribe($from, $json[1]); + return $this->_app->onSubscribe($from, $json[1]); break; case 6: - $ret = $this->_app->onUnSubscribe($from, $json[1]); + return $this->_app->onUnSubscribe($from, $json[1]); break; case 7: - $ret = $this->_app->onPublish($from, $json[1], $json[2]); + return $this->_app->onPublish($from, $json[1], $json[2]); break; default: throw new Exception('Invalid message type'); } - - // create method to loop through $ret - // json_encode messages, return $ret back to WebSocket - - return $ret; } public function __construct(ServerInterface $app) { diff --git a/lib/Ratchet/Application/WAMP/Command/Action/Event.php b/lib/Ratchet/Application/WAMP/Command/Action/Event.php new file mode 100644 index 0000000..2f4a389 --- /dev/null +++ b/lib/Ratchet/Application/WAMP/Command/Action/Event.php @@ -0,0 +1,17 @@ +setMessage(json_encode(array(8, $uri, (string)$msg))); + } +} \ No newline at end of file