WebSocketServer.php
function onMessage(ConnectionInterface $from, $msg)
    {
        $this->trigger(self::EVENT_CLIENT_MESSAGE, new WSClientMessageEvent([
            'client' => $from,
            'message' => $msg
        ]));

        if ($this->runClientCommands) {
            $command = $this->getCommand($from, $msg);

            if ($command && method_exists($this, 'command' . ucfirst($command))) {
                $this->trigger(self::EVENT_CLIENT_RUN_COMMAND, new WSClientCommandEvent([
                    'client' => $from,
                    'command' => $command
                ]));

                $result = call_user_func([$this, 'command' . ucfirst($command)], $from, $msg);

                $this->trigger(self::EVENT_CLIENT_END_COMMAND, new WSClientCommandEvent([
                    'client' => $from,
                    'command' => $command,
                    'result' => $result
                ]));
            }
        }
    }
function onMessage(ConnectionInterface $from, $msg)
    {
        $this->trigger(self::EVENT_CLIENT_MESSAGE, new WSClientMessageEvent([
            'client' => $from,
            'message' => $msg
        ]));

        if ($this->runClientCommands) {
            $command = $this->getCommand($from, $msg);

            if ($command && method_exists($this, 'command' . ucfirst($command))) {
                $this->trigger(self::EVENT_CLIENT_RUN_COMMAND, new WSClientCommandEvent([
                    'client' => $from,
                    'command' => $command
                ]));

                $result = call_user_func([$this, 'command' . ucfirst($command)], $from, $msg);

                $this->trigger(self::EVENT_CLIENT_END_COMMAND, new WSClientCommandEvent([
                    'client' => $from,
                    'command' => $command,
                    'result' => $result
                ]));
            }
        }
    }
@param ConnectionInterface $from
@param string $msg

@event WSClientMessageEvent EVENT_CLIENT_MESSAGE
@event WSClientCommandEvent EVENT_CLIENT_RUN_COMMAND
@event WSClientCommandEvent EVENT_CLIENT_END_COMMAND