Definition at line 5 of file Server.php.
◆ __construct()
◆ broadcast()
broadcast |
( |
|
$data, |
|
|
|
$controller_name = null , |
|
|
|
$except_ids = null |
|
) |
| |
Broadcast data to all clients.
- Parameters
-
mixed | $data | |
string | $controller_name | Only to clients with this controller (empty = all). |
array | $except_ids | Exclude cients with these resource ID's. |
- Returns
- array Resource ID's that received the data.
Definition at line 47 of file Server.php.
◆ getClient()
◆ getLocal()
◆ getLog()
◆ getLoop()
◆ getServer()
◆ ids()
ids |
( |
|
$controller_name = null | ) |
|
Client connection resource ID's.
- Parameters
-
string | $controller_name | Get ID's for clients with this controller (empty = all). |
- Returns
- array
Definition at line 26 of file Server.php.
◆ localBroadcast()
Broadcast data to all clients through a local connection.
- Parameters
-
array | $data | Array with a key 'data' (data to send to the clients), and optional keys 'controller' (if set only the clients with this controller will receive the data) and 'except' (if set clients with these sesion ID's will not receive the data). |
- Returns
- array Key for 'count' (number of clients that received the data).
Definition at line 131 of file Server.php.
◆ localClose()
Close one or more connections through a local connection.
- Parameters
-
array | $data | Array with optional keys 'controller' (if set only the connections for clients with this controller are closed) and 'sessions' (if set only the connections for clients with these sesion ID's are closed). |
- Returns
- array Key for 'count' (number of sessions closed).
Definition at line 103 of file Server.php.
◆ localParams()
Add or update client data (session data).
- Parameters
-
array | $data | Array with key 'sessionId'. All other data is merged with the client data. |
- Returns
- array Key for 'count' (number of data sets modified).
Definition at line 68 of file Server.php.
◆ localSessionIds()
Active session ID's through a local connection.
- Parameters
-
array | $data | Array with an optional key 'controller' (if set only the session ID' for clients with this controller are returned). |
- Returns
- array Key for 'sessionIds' (array with active session ID's).
Definition at line 89 of file Server.php.
◆ localShutdown()
Request a shutdown of the WebSocket server through a local connection.
- Parameters
-
array | $data | Expects nothing. |
Definition at line 120 of file Server.php.
◆ localToken()
Create a WebSocket access token through a local connection.
- Parameters
-
array | $data | Array with a key for the 'token'. |
- Returns
- array Key for 'time' until which the token is valid.
Definition at line 57 of file Server.php.
◆ onClose()
onClose |
( |
\Ratchet\ConnectionInterface |
$connection | ) |
|
◆ onError()
onError |
( |
\Ratchet\ConnectionInterface |
$connection, |
|
|
\Exception |
$exception |
|
) |
| |
◆ onLocalConnection()
onLocalConnection |
( |
|
$connection | ) |
|
Called on a new local connection.
- Parameters
-
\React\Socket\ConnectionInterface | $connection | |
Definition at line 158 of file Server.php.
◆ onLocalData()
Local data handler.
- Parameters
-
mixed | $data | Data received from HTTP server. |
- Returns
- mixed Response to HTTP server.
- See also
- send()
Definition at line 144 of file Server.php.
◆ onMessage()
onMessage |
( |
\Ratchet\ConnectionInterface |
$connection, |
|
|
|
$data |
|
) |
| |
◆ onOpen()
onOpen |
( |
\Ratchet\ConnectionInterface |
$connection | ) |
|
Called on a new client connection.
- Parameters
-
\Ratchet\ConnectionInterface | $connection | |
Definition at line 176 of file Server.php.
◆ run()
Run the WebSocket server.
Definition at line 231 of file Server.php.
◆ send()
Send data to a client.
- Parameters
-
int | $id | Client connection resource ID. |
mixed | $data | |
Definition at line 37 of file Server.php.
◆ $_client
Client/public WebSocket.
Definition at line 11 of file Server.php.
◆ $_local
◆ $_loop
◆ $_server
◆ $_socket
◆ $_tokens
Array with allowed client tokens (key = token, value = array with keys 'time' and 'params').
Definition at line 16 of file Server.php.
◆ $clients
Array with all connected clients (key = resource ID, value = Client object).
Definition at line 7 of file Server.php.
◆ $id
Resource ID for current client.
Definition at line 8 of file Server.php.
The documentation for this class was generated from the following file:
- /var/www/fred.local/vendor/rsi/fred/src/Rsi/Fred/Socket/Server.php