<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;

class BroadcastToStation implements ShouldBroadcastNow
{
    public $json;
    private $id;
    /**
     * Create a new event instance.
     *
     * @param int $id
     * @param string $json
     * @return void
     */
    public function __construct(int $id, string $json)
    {
        $this->id = $id;
        $this->json = $json;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('station-'.$this->id);
    }
}
