Today we can find many examples of sending message from a service worker to a client, but always following the reception of a
The interface for
Client.postMessage() is described at https://github.com/slightlyoff/ServiceWorker/issues/609. Unfortunately, it is not fully implemented in Google Chrome as of version 45, though I'd expect it to make it into a version at a later date.
When the functionality's available, you could use
self.clients.matchAll() to obtain a list of any open pages that are being controlled by the service worker, and call the
postMessage() method on the specific client that you care about. You need to keep in mind that it's entirely possible that there won't be any tabs open with a page controlled by your service worker, in which case you'd want to do something like open a new client page with your target URL.
But, there's a method that's probably more appropriate for your use case (though also not currently support in Chrome 45):
WindowClient.navigate(), which will instruct an open tab controlled by your service worker to navigate to a different URL on the same origin.