Formatting, removed flash check
This commit is contained in:
parent
f5d148cdc4
commit
c179d60e77
@ -87,22 +87,10 @@ class App {
|
|||||||
$policy->addAllowedAccess($httpHost, $port);
|
$policy->addAllowedAccess($httpHost, $port);
|
||||||
$flashSock = new Reactor($loop);
|
$flashSock = new Reactor($loop);
|
||||||
$this->flashServer = new IoServer($policy, $flashSock);
|
$this->flashServer = new IoServer($policy, $flashSock);
|
||||||
|
if (80 == $port) {
|
||||||
//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');
|
$flashSock->listen(843, '0.0.0.0');
|
||||||
}else{
|
} else {
|
||||||
fclose($test);
|
$flashSock->listen(8843);
|
||||||
trigger_error('flash socket server already running on 843', E_USER_NOTICE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,8 +126,8 @@ class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//allow origins in flash policy server
|
//allow origins in flash policy server
|
||||||
if(empty($this->flashServer) === false){
|
if(empty($this->flashServer) === false) {
|
||||||
foreach($allowedOrigins as $allowedOrgin){
|
foreach($allowedOrigins as $allowedOrgin) {
|
||||||
$this->flashServer->app->addAllowedAccess($allowedOrgin, $this->port);
|
$this->flashServer->app->addAllowedAccess($allowedOrgin, $this->port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,6 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface {
|
|||||||
$json = $json[0];
|
$json = $json[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//procURI should be un prefixed
|
|
||||||
$this->_decorating->onCall($from, $callID, $from->getUri($procURI), $json);
|
$this->_decorating->onCall($from, $callID, $from->getUri($procURI), $json);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class WampConnection extends AbstractConnectionDecorator {
|
|||||||
parent::__construct($conn);
|
parent::__construct($conn);
|
||||||
|
|
||||||
$this->WAMP = new \StdClass;
|
$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->WAMP->prefixes = array();
|
||||||
|
|
||||||
$this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));
|
$this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));
|
||||||
@ -77,7 +77,6 @@ class WampConnection extends AbstractConnectionDecorator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the full request URI from the connection object if a prefix has been established for it
|
* 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
|
* @param string $uri
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -85,8 +84,8 @@ class WampConnection extends AbstractConnectionDecorator {
|
|||||||
$curieSeperator = ':';
|
$curieSeperator = ':';
|
||||||
$fullSeperator = '#';
|
$fullSeperator = '#';
|
||||||
|
|
||||||
if(preg_match('/http(s*)\:\/\//', $uri) == false){
|
if (preg_match('/http(s*)\:\/\//', $uri) == false) {
|
||||||
if(strpos($uri, $curieSeperator) !== false){
|
if (strpos($uri, $curieSeperator) !== false) {
|
||||||
list($prefix, $action) = explode($curieSeperator, $uri);
|
list($prefix, $action) = explode($curieSeperator, $uri);
|
||||||
$expandedPrefix = isset($this->WAMP->prefixes[$prefix]) ? $this->WAMP->prefixes[$prefix] : $prefix;
|
$expandedPrefix = isset($this->WAMP->prefixes[$prefix]) ? $this->WAMP->prefixes[$prefix] : $prefix;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user