Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a boolean $fallback variable to App.php in order to make Flash fallback an optional feature #676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/Ratchet/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class App {
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
* @param boolean $fallback Enable/Disable the Flash socket fallback.
*/
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $fallback = true) {
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
}
Expand All @@ -82,13 +83,11 @@ public function __construct($httpHost = 'localhost', $port = 8080, $address = '1
$policy->addAllowedAccess($httpHost, 80);
$policy->addAllowedAccess($httpHost, $port);

if (80 == $port) {
$flashUri = '0.0.0.0:843';
} else {
$flashUri = 8843;
if ($fallback) {
$flashUri = (80 == $port) ? '0.0.0.0:843' : 8843;
$flashSock = new Reactor($flashUri, $loop);
$this->flashServer = new IoServer($policy, $flashSock);
}
$flashSock = new Reactor($flashUri, $loop);
$this->flashServer = new IoServer($policy, $flashSock);
}

/**
Expand Down