WAMP Cleanup

Fixed a bug in getURI
Cleaned up roc calls - cleaner api, no more call_() calls
This commit is contained in:
Chris Boden 2012-01-17 22:47:17 -05:00
parent eb82a7ab04
commit dbcb6f2cde
3 changed files with 12 additions and 4 deletions

View File

@ -65,8 +65,14 @@ class App implements WebSocketAppInterface {
case 2:
array_shift($json);
array_unshift($json, $from);
return call_user_func_array(array($this->_app, 'onCall'), $json);
$callID = array_shift($json);
$procURI = array_shift($json);
if (count($json) == 1 && is_array($json[0])) {
$json = $json[0];
}
return $this->_app->onCall($from, $callID, $procURI, $json);
break;
case 5:
@ -93,7 +99,7 @@ class App implements WebSocketAppInterface {
* @return string
*/
protected function getUri(Connection $conn, $uri) {
$ret = (isset($conn->WAMP->prefixes[$uri]) ? $conn->WAMP->prefixes[$uri] : $uri);
return (isset($conn->WAMP->prefixes[$uri]) ? $conn->WAMP->prefixes[$uri] : $uri);
}
public function __construct(ServerInterface $app) {

View File

@ -10,6 +10,7 @@ class Event extends SendMessage {
/**
* @param ...
* @param string
* @return Event
*/
public function setEvent($uri, $msg) {
return $this->setMessage(json_encode(array(8, $uri, (string)$msg)));

View File

@ -33,9 +33,10 @@ interface ServerInterface {
* @param Ratchet\Resource\Connection
* @param string
* @param ...
* @param array Call parameters received from the client
* @return Ratchet\Resource\Command\CommandInterface|null
*/
function onCall();
function onCall(Connection $conn, $id, $procURI, array $params);
/**
* A request to subscribe to a URI has been made