PHP Interface Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface

Show file Open project: sulu/sulu Interface Usage Examples

Public Methods

Method Description
add ( string $name, Sulu\Component\Websocket\MessageDispatcher\MessageHandlerInterface $handler )
dispatch ( Ratchet\ConnectionInterface $conn, string $name, array $message, array $options, Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context ) Dispatch event to handler with given name.
onClose ( Ratchet\ConnectionInterface $conn, Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context ) All message handler get the message that the connection is losed.

Method Details

add() public method

public add ( string $name, Sulu\Component\Websocket\MessageDispatcher\MessageHandlerInterface $handler )
$name string Message name
$handler Sulu\Component\Websocket\MessageDispatcher\MessageHandlerInterface Handler which process messages with given name

dispatch() public method

Dispatch event to handler with given name.
public dispatch ( Ratchet\ConnectionInterface $conn, string $name, array $message, array $options, Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context )
$conn Ratchet\ConnectionInterface
$name string Message name
$message array
$options array
$context Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface

onClose() public method

All message handler get the message that the connection is losed.
public onClose ( Ratchet\ConnectionInterface $conn, Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context )
$conn Ratchet\ConnectionInterface
$context Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface