Answer the question
In order to leave comments, you need to log in
Yii2 websocket connect in controller?
Hello! people tell me how to use yii2 websockets? I installed from here: https://github.com/consik/yii2-websocket
Everything works great. But there was a need to send commands and messages not from javascript, but from php. I can't figure out how to connect a socket in the controller and apply it. Tried like this:
public function action***() {
$event = new WSClientMessageEvent;
$event->message = 'awdawdawd';
$this->trigger(self::EVENT_CLIENT_MESSAGE, $event);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question