PHP Class PHPDaemon\Servers\WebSocket\Pool

Inheritance: extends PHPDaemon\Network\Server, use trait PHPDaemon\Traits\EventHandlers
Show file Open project: kakserpom/phpdaemon Class Usage Examples

Public Properties

Property Type Description
$routes array

Public Methods

Method Description
addRoute ( string $path, callable $cb ) : boolean Adds a route if it doesn't exist already.
getRoute ( string $path, object $client, boolean $withoutCustomTransport = false ) : mixed
getRouteOptions ( string $path ) : array Return options by route
removeRoute ( string $path ) : boolean Removes a route.
routeExists ( string $path ) : boolean Checks if route exists
setRoute ( string $path, callable $cb ) : boolean Force add/replace a route.
setRouteOptions ( string $path, array $opts ) : boolean Sets an array of options associated to the route

Protected Methods

Method Description
getConfigDefaults ( ) : array | boolean Setting default config options Overriden from ConnectionPool::getConfigDefaults

Method Details

addRoute() public method

Adds a route if it doesn't exist already.
public addRoute ( string $path, callable $cb ) : boolean
$path string Route name.
$cb callable Route's callback.
return boolean Success.

getConfigDefaults() protected method

Setting default config options Overriden from ConnectionPool::getConfigDefaults
protected getConfigDefaults ( ) : array | boolean
return array | boolean

getRoute() public method

public getRoute ( string $path, object $client, boolean $withoutCustomTransport = false ) : mixed
$path string
$client object
$withoutCustomTransport boolean
return mixed

getRouteOptions() public method

Return options by route
public getRouteOptions ( string $path ) : array
$path string Route name
return array Options

removeRoute() public method

Removes a route.
public removeRoute ( string $path ) : boolean
$path string Route name
return boolean Success

routeExists() public method

Checks if route exists
public routeExists ( string $path ) : boolean
$path string Route name
return boolean Exists?

setRoute() public method

Force add/replace a route.
public setRoute ( string $path, callable $cb ) : boolean
$path string Path
$cb callable Callback
return boolean Success

setRouteOptions() public method

Sets an array of options associated to the route
public setRouteOptions ( string $path, array $opts ) : boolean
$path string Route name.
$opts array Options
return boolean Success.

Property Details

$routes public property

public array $routes
return array