app/Events/BroadcastToUserEvent.php
/**
     * Get the channels the event should broadcast on.
     *
     * @return array
     */
Get the channels the event should broadcast on.
@return array
Get the channels the event should broadcast on . @return array
public function broadcastOn()
    {
        $token = $this->user->socket_token;
        if ($this->user->id == auth()->id()) {
            return [];
        }
        if (! \Redis::sIsMember('users', $token)) {
            return [];
        }
        return [$token];
    }
public function broadcastOn ( ) { $ token = $ this -> user -> socket_token ; if ( $ this -> user -> id == auth ( ) -> id ( ) ) { return [ ] ; } if ( ! \ Redis :: sIsMember ( 'users' , $ token ) ) { return [ ] ; } return [ $ token ] ; }
Get the channels the event should broadcast on.
Get the channels the event should broadcast on .
// Use socket token as a channel // Don't send to myself // Check if token is in list of connected users