src/RatchetServer.php
public function onMessage(ConnectionInterface $from, $message)
    {
        $message = json_decode($message);

        // TODO: Various auth checks and safety. We don't want to try to handle anything/everything from the client!
        $channel = $message->message->channel;

        if ($message->event == 'subscribe') {
            // Tie the connection to the channel
            $this->subscribedTopics[$channel][] = $from;
        }
    }
public function onMessage(ConnectionInterface $from, $message)
    {
        $message = json_decode($message);

        // TODO: Various auth checks and safety. We don't want to try to handle anything/everything from the client!
        $channel = $message->message->channel;

        if ($message->event == 'subscribe') {
            // Tie the connection to the channel
            $this->subscribedTopics[$channel][] = $from;
        }
    }
public function onMessage ( ConnectionInterface $ from , $ message ) { $ message = json_decode ( $ message ) ; // TODO: Various auth checks and safety. We don't want to try to handle anything/everything from the client! $ channel = $ message -> message -> channel ; if ( $ message -> event == 'subscribe' ) { // Tie the connection to the channel $ this -> subscribedTopics [ $ channel ] [ ] = $ from ; } }
Client-side message from Echo
Client - side message from Echo