Trying to deal with the work of Websocet seemed to find a normal solution and downloaded the add-ons did everything according to the instructions, except put the Chat3WebsocketDaemonHandler class in the console / models folder and in the config / console / config / main.php
'websocket' => [ 'class' => 'morozovsk\yii2websocket\Connection', 'servers' => [ 'chat3' => [ 'class' => 'console\models\Chat3WebsocketDaemonHandler', 'pid' => '/tmp/websocket_chat.pid', 'websocket' => 'tcp://127.0.0.1:8004', 'localsocket' => 'tcp://127.0.0.1:8010', //'master' => 'tcp://127.0.0.1:8020', //'eventDriver' => 'event' ] ], ], he himself took this class from you from here, but a little bit was modified to such
<?php namespace console\models; class Chat3WebsocketDaemonHandler extends \morozovsk\websocket\Daemon { protected function onOpen($connectionId, $info) { //call when new client connect to server $message ="yes"; } protected function onClose($connectionId) { //call when existing client close connection } protected function onMessage($connectionId, $data, $type) { //call when new message from existing client $message = "user #{$connectionId}: $data"; //send message to all client foreach ($this->clients as $clientId => $client) { $this->sendToClient($clientId, $message); } } } now I try to start like this ./yii websocket / start chat3 and the reaction is not something that would be zero but this is the reaction
and if I start to write something like this, I understand that this chat should not work that way, can you tell me where I’ve been on