title: Service worker communicate to clients
body: <p>I have been trying to send messages to clients from service worker but if I use </p>
  
  <pre><code>self.clients.matchAll()
  .then((clients) =&gt; {
    clients.forEach(function(client) {
      client.postMessage({msg: 'Hello from SW'})
    })
  })
  </code></pre>
  
  <p>it won't send to any client even if I have a tab open in the browser, but if I send a message from the <strong>client</strong> to the <strong>service worker</strong></p>
  
  <pre><code>// client
  navigator.serviceWorker.controller.postMessage({title: 'Send message from client'})
  </code></pre>
  
  <p>and in the service worker</p>
  
  <pre><code>self.addEventListener('message', function(event) {
    self.clients.fetchAll()
      .then((clients) =&gt; {
        clients.forEach(function(client) {
          client.postMessage({msg: 'Hello from SW'})
       })
    })
  })
  </code></pre>
  
  <p>it can send a message and finds clients.
  what am I doing wrong?, should I use indexedDB instead?</p>