diff --git a/src/Ratchet/Wamp/WampConnection.php b/src/Ratchet/Wamp/WampConnection.php index 6e46eba..a0bf523 100644 --- a/src/Ratchet/Wamp/WampConnection.php +++ b/src/Ratchet/Wamp/WampConnection.php @@ -82,14 +82,15 @@ class WampConnection extends AbstractConnectionDecorator { * @return string */ public function getUri($uri) { - $seperator = ':'; + $curieSeperator = ':'; + $fullSeperator = '#'; - if(preg_match('/http(s*)\:\/\//', $uri) === false){ - if(strpos($uri, $seperator) !== false){ - list($prefix, $action) = explode(':', $uri); + if(preg_match('/http(s*)\:\/\//', $uri) == false){ + if(strpos($uri, $curieSeperator) !== false){ + list($prefix, $action) = explode($curieSeperator, $uri); $expandedPrefix = isset($this->WAMP->prefixes[$prefix]) ? $this->WAMP->prefixes[$prefix] : $prefix; - return $expandedPrefix . '#' . $action; + return $expandedPrefix . $fullSeperator . $action; } } diff --git a/tests/unit/Wamp/ServerProtocolTest.php b/tests/unit/Wamp/ServerProtocolTest.php index 1b423d2..082a3f5 100644 --- a/tests/unit/Wamp/ServerProtocolTest.php +++ b/tests/unit/Wamp/ServerProtocolTest.php @@ -211,13 +211,14 @@ class ServerProtocolTest extends \PHPUnit_Framework_TestCase { $conn = new WampConnection($this->newConn()); $this->_comp->onOpen($conn); - $shortIn = 'incoming'; - $longIn = 'http://example.com/incoming/'; + $prefix = 'incoming'; + $fullURI = "http://example.com/$prefix"; + $method = 'call'; - $this->_comp->onMessage($conn, json_encode(array(1, $shortIn, $longIn))); + $this->_comp->onMessage($conn, json_encode(array(1, $prefix, $fullURI))); - $this->assertEquals($longIn, $conn->WAMP->prefixes[$shortIn]); - $this->assertEquals($longIn, $conn->getUri($shortIn)); + $this->assertEquals($fullURI, $conn->WAMP->prefixes[$prefix]); + $this->assertEquals("$fullURI#$method", $conn->getUri("$prefix:$method")); } public function testMessageMustBeJson() {