Formatting, removed flash check
This commit is contained in:
parent
f5d148cdc4
commit
c179d60e77
@ -87,22 +87,10 @@ class App {
|
||||
$policy->addAllowedAccess($httpHost, $port);
|
||||
$flashSock = new Reactor($loop);
|
||||
$this->flashServer = new IoServer($policy, $flashSock);
|
||||
|
||||
//check if another App is already running a flash policy server on 843
|
||||
$test = @fsockopen('127.0.0.1', 843, $errno, $errstr, 5);
|
||||
|
||||
//if not start a flash policy serever
|
||||
if(is_resource($test) === false){
|
||||
$policy = new FlashPolicy;
|
||||
$policy->addAllowedAccess($httpHost, 80);
|
||||
$policy->addAllowedAccess($httpHost, $port);
|
||||
$flashSock = new Reactor($loop);
|
||||
$this->flashServer = new IoServer($policy, $flashSock);
|
||||
|
||||
$flashSock->listen(843, '0.0.0.0');
|
||||
}else{
|
||||
fclose($test);
|
||||
trigger_error('flash socket server already running on 843', E_USER_NOTICE);
|
||||
if (80 == $port) {
|
||||
$flashSock->listen(843, '0.0.0.0');
|
||||
} else {
|
||||
$flashSock->listen(8843);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,10 +126,10 @@ class App {
|
||||
}
|
||||
|
||||
//allow origins in flash policy server
|
||||
if(empty($this->flashServer) === false){
|
||||
foreach($allowedOrigins as $allowedOrgin){
|
||||
$this->flashServer->app->addAllowedAccess($allowedOrgin, $this->port);
|
||||
}
|
||||
if(empty($this->flashServer) === false) {
|
||||
foreach($allowedOrigins as $allowedOrgin) {
|
||||
$this->flashServer->app->addAllowedAccess($allowedOrgin, $this->port);
|
||||
}
|
||||
}
|
||||
|
||||
$this->routes->add('rr-' . ++$this->_routeCounter, new Route($path, array('_controller' => $decorated), array('Origin' => $this->httpHost), array(), $httpHost));
|
||||
|
@ -107,7 +107,6 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface {
|
||||
$json = $json[0];
|
||||
}
|
||||
|
||||
//procURI should be un prefixed
|
||||
$this->_decorating->onCall($from, $callID, $from->getUri($procURI), $json);
|
||||
break;
|
||||
|
||||
|
@ -17,7 +17,7 @@ class WampConnection extends AbstractConnectionDecorator {
|
||||
parent::__construct($conn);
|
||||
|
||||
$this->WAMP = new \StdClass;
|
||||
$this->WAMP->sessionId = str_replace('.','',uniqid(mt_rand(), true));
|
||||
$this->WAMP->sessionId = str_replace('.', '', uniqid(mt_rand(), true));
|
||||
$this->WAMP->prefixes = array();
|
||||
|
||||
$this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));
|
||||
@ -77,24 +77,23 @@ class WampConnection extends AbstractConnectionDecorator {
|
||||
|
||||
/**
|
||||
* Get the full request URI from the connection object if a prefix has been established for it
|
||||
* Compliant with WAMP Spec for curie URIs
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
public function getUri($uri) {
|
||||
$curieSeperator = ':';
|
||||
$fullSeperator = '#';
|
||||
$curieSeperator = ':';
|
||||
$fullSeperator = '#';
|
||||
|
||||
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;
|
||||
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 . $fullSeperator . $action;
|
||||
return $expandedPrefix . $fullSeperator . $action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $uri;
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user