Here is my Symfony3 command that I'm using for websocket server purpose
public function __construct(ChatFlowProcessor $chatManager, int $webSocketPort)
{
$this->chatManager = $chatManager;
$this->webSocketPort = $webSocketPort;
parent::__construct();
}
$server = IoServer::factory(
new HttpServer(
new WsServer(
$this->chatManager
)
),
$this->webSocketPort
);
$server->run();
As you see, I've got a chatManager simply using Symfony3 autowiring. The service implements Ratchet MessageComponentInterface.
Now, I want to get access to the server from outside of the connection. I mean, send a message to websocket client using my chatManager, apparently I need to get access to chatManager instance, that stored in WsServer and keep information about all active connections.
Is it possible? Thanks.
from Ratchet + Symfony3: how to get access to current server from outside
No comments:
Post a Comment