getLoop() public method

Get loop
public getLoop ( ) : React\EventLoop\LoopInterface
return React\EventLoop\LoopInterface
Example #1
0
 public function testLoopCreated()
 {
     $this->assertInstanceOf('\\React\\EventLoop\\LoopInterface', $this->router->getLoop());
 }
Example #2
0
<?php

require_once __DIR__ . '/bootstrap.php';
require_once __DIR__ . '/Clients/InternalClient.php';
require_once __DIR__ . '/Clients/SimpleAuthProviderClient.php';
require_once __DIR__ . '/Clients/AbortAfterHelloAuthProviderClient.php';
require_once __DIR__ . '/Clients/DisclosePublisherClient.php';
use Thruway\Logging\Logger;
use Thruway\Peer\Router;
use Thruway\Transport\RatchetTransportProvider;
//Logger::set(new \Psr\Log\NullLogger());
$timeout = isset($argv[1]) ? $argv[1] : 0;
$router = new Router();
$loop = $router->getLoop();
$authMgr = new \Thruway\Authentication\AuthenticationManager();
$router->setAuthenticationManager($authMgr);
$router->addTransportProvider(new \Thruway\Transport\InternalClientTransportProvider($authMgr));
//Provide authentication for the realm: 'testSimpleAuthRealm'
$authProvClient = new SimpleAuthProviderClient(["testSimpleAuthRealm", "authful_realm"]);
$router->addTransportProvider(new \Thruway\Transport\InternalClientTransportProvider($authProvClient));
// provide aborting auth provider
$authAbortAfterHello = new AbortAfterHelloAuthProviderClient(["abortafterhello"]);
$router->addTransportProvider(new \Thruway\Transport\InternalClientTransportProvider($authAbortAfterHello));
////////////////////
// Test stuff for Authorization
$authorizationManager = new \Thruway\Authentication\AuthorizationManager('authorizing_realm');
$authorizingRealm = new \Thruway\Realm('authorizing_realm');
$authorizingRealm->setAuthorizationManager($authorizationManager);
$router->getRealmManager()->addRealm($authorizingRealm);
$router->addTransportProvider(new \Thruway\Transport\InternalClientTransportProvider($authorizationManager));
// Create a realm with Authentication also
<?php

use SlackWamp\SlackClient;
use Thruway\Peer\Router;
use Thruway\Transport\PawlTransportProvider;
use Thruway\Transport\RatchetTransportProvider;
require '../vendor/autoload.php';
$token = 'your_slack_token';
//your slack token https://my.slack.com/services/new/bot
$realm = 'realm1';
// WAMP Realm
$uri = 'ws://127.0.0.1:9090/';
// WAMP Router URI
$router = new Router();
$router->addTransportProvider(new RatchetTransportProvider("127.0.0.1", 9090));
$client = new SlackClient($token, $realm, $router->getLoop());
$client->addTransportProvider(new PawlTransportProvider($uri));
$client->start(false);
$router->start();