title: Emitting a js event to Livewire with data
body: <p>I have a component where each row is a separate component. I'm emitting an event using Echo + Pusher, and I want to scope the event to only refresh the relevant row.</p>
  <p>This isn't described in the docs, but there's an old (and possibly outdated) video by Caleb Porzio (creator of Livewire) in <a href="https://calebporzio.com/video-realtime-livewire-w-laravel-echo-pusher" rel="nofollow noreferrer">this article</a> (last video, ~8m30s) where this is done by adding the relevant ID into the event name.</p>
  <p>In my livewire model, I have:</p>
  <pre><code>public function getListeners()
  {
      return [
          &quot;HitReceived:{$this-&gt;monitorId}&quot; =&gt; 'refresh',
      ];
  }
  </code></pre>
  <p>And in my JS I have:</p>
  <pre><code>Livewire.emit('HitReceived:' + data.monitorId);
  </code></pre>
  <p>I can see in the console that <code>data.monitorId</code> is set. When I fire an event with id #1, I get a 500 error:</p>
  <pre><code>ERROR: Undefined array key &quot;HitReceived1&quot; {&quot;userId&quot;:1,&quot;exception&quot;:&quot;[object] (ErrorException(code: 0):
  Undefined array key \&quot;HitReceived1\&quot; at /vendor/livewire/livewire/src/ComponentConcerns/ReceivesEvents.php:72)
  </code></pre>
  <p>(This all works if I don't scope my event to a particular model instance, but then everything refreshes.)</p>