PHP Class Sulu\Bundle\WebsocketBundle\App\WebsocketApp

Datei anzeigen Open project: sulu/sulu Class Usage Examples

Public Properties

Property Type Description
$routes Symfony\Component\Routing\RouteCollection

Protected Properties

Property Type Description
$_routeCounter integer
$_server Ratchet\Server\IoServer
$httpHost string The Host passed in construct used for same origin policy.
$port * The port the socket is listening

Public Methods

Method Description
__construct ( string $httpHost = 'localhost', integer $port = 8080, string $address = '127.0.0.1', React\EventLoop\LoopInterface $loop = null )
route ( string $path, Ratchet\ComponentInterface $controller, array $allowedOrigins = [], string $httpHost = null ) : Ratchet\ComponentInterface | Ratchet\WebSocket\WsServer Add an endpoint/application to the server.
run ( ) Run the server by entering the event loop.

Method Details

__construct() public method

public __construct ( string $httpHost = 'localhost', integer $port = 8080, string $address = '127.0.0.1', React\EventLoop\LoopInterface $loop = null )
$httpHost string HTTP hostname clients intend to connect to. MUST match JS `new WebSocket('ws://$httpHost');`
$port integer Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
$address string IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine
$loop React\EventLoop\LoopInterface Specific React\EventLoop to bind the application to. null will create one for you

route() public method

Add an endpoint/application to the server.
public route ( string $path, Ratchet\ComponentInterface $controller, array $allowedOrigins = [], string $httpHost = null ) : Ratchet\ComponentInterface | Ratchet\WebSocket\WsServer
$path string The URI the client will connect to
$controller Ratchet\ComponentInterface Your application to server for the route. If not specified, assumed to be for a WebSocket
$allowedOrigins array An array of hosts allowed to connect (same host by default), ['*'] for any
$httpHost string Override the $httpHost variable provided in the __construct
return Ratchet\ComponentInterface | Ratchet\WebSocket\WsServer

run() public method

Run the server by entering the event loop.
public run ( )

Property Details

$_routeCounter protected_oe property

protected int $_routeCounter
return integer

$_server protected_oe property

protected IoServer,Ratchet\Server $_server
return Ratchet\Server\IoServer

$httpHost protected_oe property

The Host passed in construct used for same origin policy.
protected string $httpHost
return string

$port protected_oe property

* The port the socket is listening
protected $port

$routes public_oe property

public RouteCollection,Symfony\Component\Routing $routes
return Symfony\Component\Routing\RouteCollection