PHP Класс Sulu\Bundle\WebsocketBundle\App\WebsocketApp

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$routes Symfony\Component\Routing\RouteCollection

Защищенные свойства (Protected)

Свойство Тип Описание
$_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

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

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() публичный Метод

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
Результат Ratchet\ComponentInterface | Ratchet\WebSocket\WsServer

run() публичный Метод

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

Описание свойств

$_routeCounter защищенное свойство

protected int $_routeCounter
Результат integer

$_server защищенное свойство

protected IoServer,Ratchet\Server $_server
Результат Ratchet\Server\IoServer

$httpHost защищенное свойство

The Host passed in construct used for same origin policy.
protected string $httpHost
Результат string

$port защищенное свойство

* The port the socket is listening
protected $port

$routes публичное свойство

public RouteCollection,Symfony\Component\Routing $routes
Результат Symfony\Component\Routing\RouteCollection