diff --git a/src/Ratchet/App.php b/src/Ratchet/App.php index cc4aea4..cc724fc 100644 --- a/src/Ratchet/App.php +++ b/src/Ratchet/App.php @@ -1,5 +1,7 @@ routes = new RouteCollection; $this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop); - $policy = new FlashPolicy; + $policy = new FlashPolicy(); $policy->addAllowedAccess($httpHost, 80); $policy->addAllowedAccess($httpHost, $port); $flashSock = new Reactor($loop); @@ -87,6 +89,24 @@ class App { $flashSock->listen(8843); } } + + /** + * Returns the FlashPolicy running in the flash server. Modifications of this object take effect immediately! + * + * @return FlashPolicy + */ + public function getFlashPolicy() { + return $this->flashServer->app; + } + + /** + * Returns the FlashSocket of the flash server. + * + * @return \React\Socket\ServerInterface + */ + public function getFlashSocket() { + return $this->flashServer->socket; + } /** * Add an endpiont/application to the server @@ -131,3 +151,4 @@ class App { $this->_server->run(); } } + diff --git a/src/Ratchet/Server/FlashPolicy.php b/src/Ratchet/Server/FlashPolicy.php index 4997362..4a1b8bd 100644 --- a/src/Ratchet/Server/FlashPolicy.php +++ b/src/Ratchet/Server/FlashPolicy.php @@ -71,6 +71,18 @@ class FlashPolicy implements MessageComponentInterface { return $this; } + + /** + * Removes all domains from the allowed access list. + * + * @return \Ratchet\Server\FlashPolicy + */ + public function clearAllowedAccess() { + $this->_access = array(); + $this->_cacheValid = false; + + return $this; + } /** * site-control defines the meta-policy for the current domain. A meta-policy specifies acceptable diff --git a/src/Ratchet/Server/IoServer.php b/src/Ratchet/Server/IoServer.php index b27ee93..160a1fc 100644 --- a/src/Ratchet/Server/IoServer.php +++ b/src/Ratchet/Server/IoServer.php @@ -1,5 +1,7 @@ loop = $loop; $this->app = $app; + $this->socket = $socket; $socket->on('connection', array($this, 'handleConnect'));