Skip to content

Commit

Permalink
Make sure that a WAMP url and realm is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwdan committed Nov 7, 2016
1 parent 8a17274 commit 39f45c3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/thruway
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ require __DIR__ . '/../vendor/autoload.php';

error_reporting(-1);

if (!isset($argv[1]) || !isset($argv[2])) {
echo "You must provide a WAMP url and realm. ie. {$argv[0]} wss://demo.crossbar.io/ws realm1", PHP_EOL;
return;
}

$historyFile = ".history";
$client = new Client($argv[1], $argv[2]);
$router = new Router();
Expand Down Expand Up @@ -58,15 +63,15 @@ $router->add('register <uri> [<options>]', function (array $args) use ($client,
echo "RPC called with: ", json_encode($args), PHP_EOL;

if (isset($details->receive_progress) && $details->receive_progress === true) {
echo "Reply to RPC. Press enter to send and type 'done' when finished.", PHP_EOL,"thruway> ";
echo "Reply to RPC. Press enter to send and type 'done' when finished.", PHP_EOL, "thruway> ";
return $line->takeWhile(function ($l) {
return $l !== "done";
})->doOnCompleted(function () use (&$awaitingReply) {
$awaitingReply = false;
});
}

echo "Reply to RPC", PHP_EOL,"thruway> ";
echo "Reply to RPC", PHP_EOL, "thruway> ";
return $line->take(1)->doOnNext(function () use (&$awaitingReply) {
$awaitingReply = false;
});
Expand Down

0 comments on commit 39f45c3

Please sign in to comment.