PHP Class Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherApp

Inheritance: extends Sulu\Component\Websocket\AbstractWebsocketApp, implements Ratchet\MessageComponentInterface
Show file Open project: sulu/sulu Class Usage Examples

Protected Properties

Property Type Description
$messageDispatcher Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface
$name

Public Methods

Method Description
__construct ( $appName, Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface $messageDispatcher, Doctrine\Common\Cache\Cache $contextsCache )
onClose ( Ratchet\ConnectionInterface $connection )
onMessage ( Ratchet\ConnectionInterface $from, string $msg ) Triggered when a client sends data through the socket.

Protected Methods

Method Description
createMessageHandlerContext ( Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context, string $handlerName ) : MessageHandlerContext Create a message handler context.

Private Methods

Method Description
dispatch ( Ratchet\ConnectionInterface $conn, Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context, array $msg ) Dispatches message to handler with dispatcher service.

Method Details

__construct() public method

public __construct ( $appName, Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface $messageDispatcher, Doctrine\Common\Cache\Cache $contextsCache )
$messageDispatcher Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface
$contextsCache Doctrine\Common\Cache\Cache

createMessageHandlerContext() protected method

Create a message handler context.
protected createMessageHandlerContext ( Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface $context, string $handlerName ) : MessageHandlerContext
$context Sulu\Component\Websocket\ConnectionContext\ConnectionContextInterface
$handlerName string
return MessageHandlerContext

onClose() public method

public onClose ( Ratchet\ConnectionInterface $connection )
$connection Ratchet\ConnectionInterface

onMessage() public method

Triggered when a client sends data through the socket.
public onMessage ( Ratchet\ConnectionInterface $from, string $msg )
$from Ratchet\ConnectionInterface The socket/connection that sent the message to your application
$msg string The message received

Property Details

$messageDispatcher protected property

protected MessageDispatcherInterface,Sulu\Component\Websocket\MessageDispatcher $messageDispatcher
return Sulu\Component\Websocket\MessageDispatcher\MessageDispatcherInterface

$name protected property

protected $name