Merge branch 'refs/heads/flash-policy-fix'
This commit is contained in:
commit
a0db6e6727
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Ratchet;
|
||||
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\EventLoop\Factory as LoopFactory;
|
||||
use React\Socket\Server as Reactor;
|
||||
@ -75,7 +77,7 @@ class App {
|
||||
$this->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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Ratchet\Server;
|
||||
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\Socket\ServerInterface;
|
||||
@ -26,6 +28,12 @@ class IoServer {
|
||||
* @var \SplFixedArray
|
||||
*/
|
||||
protected $handlers;
|
||||
|
||||
/**
|
||||
* The socket server the Ratchet Application is run off of
|
||||
* @var \React\Socket\ServerInterface
|
||||
*/
|
||||
public $socket;
|
||||
|
||||
/**
|
||||
* @param \Ratchet\MessageComponentInterface $app The Ratchet application stack to host
|
||||
@ -42,6 +50,7 @@ class IoServer {
|
||||
|
||||
$this->loop = $loop;
|
||||
$this->app = $app;
|
||||
$this->socket = $socket;
|
||||
|
||||
$socket->on('connection', array($this, 'handleConnect'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user