PHP Class Thruway\Peer\Router

Inheritance: implements Thruway\Peer\RouterInterface, implements Thruway\Event\EventSubscriberInterface
Show file Open project: voryx/thruway Class Usage Examples

Protected Properties

Property Type Description
$started boolean

Public Methods

Method Description
__construct ( React\EventLoop\LoopInterface $loop = null ) Constructor
addInternalClient ( Thruway\Peer\ClientInterface $client ) Add a client that uses the internal transport provider
addTransportProvider ( Thruway\Transport\RouterTransportProviderInterface $transportProvider ) Add a transport provider
createNewSession ( Thruway\Transport\TransportInterface $transport )
getAuthenticationManager ( ) Get authentication manager
getAuthorizationManager ( )
getEventDispatcher ( ) : Thruway\Event\EventDispatcherInterface
getLoop ( ) : React\EventLoop\LoopInterface Get loop
getRealmManager ( ) : RealmManager Get realm manager
getSessionBySessionId ( integer $sessionId ) : Session | boolean Get session by session ID
getSubscribedEvents ( ) Register for events
handleConnectionClose ( ConnectionCloseEvent $event )
handleConnectionOpen ( ConnectionOpenEvent $event )
managerGetRealms ( ) : array Get list realms
managerGetSessionCount ( ) : array Count number sessions
managerGetSessions ( ) : array Get list sessions
onClose ( Thruway\Transport\TransportInterface $transport ) Handle close transport
onMessage ( Thruway\Transport\TransportInterface $transport, Thruway\Message\Message $msg ) : void Handle transport received message
registerModule ( Thruway\Module\RouterModuleInterface $module ) Registers a RouterModule
registerModules ( array $modules ) Register Multiple Modules
setAuthenticationManager ( $authenticationManager ) Set authentication manager
setAuthorizationManager ( $authorizationManager )
setRealmManager ( RealmManager $realmManager ) Set realm manager
start ( boolean $runLoop = true ) Start router
stop ( $gracefully = true )

Method Details

__construct() public method

Constructor
public __construct ( React\EventLoop\LoopInterface $loop = null )
$loop React\EventLoop\LoopInterface

addInternalClient() public method

Add a client that uses the internal transport provider
public addInternalClient ( Thruway\Peer\ClientInterface $client )
$client Thruway\Peer\ClientInterface

addTransportProvider() public method

Add a transport provider
public addTransportProvider ( Thruway\Transport\RouterTransportProviderInterface $transportProvider )
$transportProvider Thruway\Transport\RouterTransportProviderInterface

createNewSession() public method

public createNewSession ( Thruway\Transport\TransportInterface $transport )
$transport Thruway\Transport\TransportInterface

getAuthenticationManager() public method

Get authentication manager
Deprecation:

getAuthorizationManager() public method

Deprecation:

getEventDispatcher() public method

public getEventDispatcher ( ) : Thruway\Event\EventDispatcherInterface
return Thruway\Event\EventDispatcherInterface

getLoop() public method

Get loop
public getLoop ( ) : React\EventLoop\LoopInterface
return React\EventLoop\LoopInterface

getRealmManager() public method

Get realm manager
public getRealmManager ( ) : RealmManager
return Thruway\RealmManager

getSessionBySessionId() public method

Get session by session ID
public getSessionBySessionId ( integer $sessionId ) : Session | boolean
$sessionId integer
return Thruway\Session | boolean

getSubscribedEvents() public static method

Register for events
public static getSubscribedEvents ( )

handleConnectionClose() public method

public handleConnectionClose ( ConnectionCloseEvent $event )
$event Thruway\Event\ConnectionCloseEvent

handleConnectionOpen() public method

public handleConnectionOpen ( ConnectionOpenEvent $event )
$event Thruway\Event\ConnectionOpenEvent

managerGetRealms() public method

Get list realms
public managerGetRealms ( ) : array
return array

managerGetSessionCount() public method

Count number sessions
public managerGetSessionCount ( ) : array
return array

managerGetSessions() public method

Get list sessions
public managerGetSessions ( ) : array
return array

onClose() public method

Handle close transport
public onClose ( Thruway\Transport\TransportInterface $transport )
$transport Thruway\Transport\TransportInterface

onMessage() public method

Handle transport received message
public onMessage ( Thruway\Transport\TransportInterface $transport, Thruway\Message\Message $msg ) : void
$transport Thruway\Transport\TransportInterface
$msg Thruway\Message\Message
return void

registerModule() public method

Registers a RouterModule
public registerModule ( Thruway\Module\RouterModuleInterface $module )
$module Thruway\Module\RouterModuleInterface

registerModules() public method

Register Multiple Modules
public registerModules ( array $modules )
$modules array

setAuthenticationManager() public method

Set authentication manager
Deprecation:
public setAuthenticationManager ( $authenticationManager )

setAuthorizationManager() public method

Deprecation:
public setAuthorizationManager ( $authorizationManager )
$authorizationManager

setRealmManager() public method

Set realm manager
public setRealmManager ( RealmManager $realmManager )
$realmManager Thruway\RealmManager

start() public method

Start router
public start ( boolean $runLoop = true )
$runLoop boolean

stop() public method

public stop ( $gracefully = true )

Property Details

$started protected property

protected bool $started
return boolean