Is it possible to intercept and cache WebSocket messages in a Service Worker like all the examples do for normal HTTP requests?
<p>I know you can create WebSocket connections from within a Service Worker itself; my question is more whether or not you can use a WebSocket from your app as normal and have the Service Worker intercept / cache WebSocket requests just like it can do for normal HTTP fetch requests?</p>

<p>Here's an example of intercepting and caching a normal HTTP request from a Service Worker.</p>

<pre><code>self.addEventListener('fetch', function(event) {
  // If a match isn't found in the cache, the response
  // will look like a connection error
  event.respondWith(caches.match(event.request));
});
</code></pre>

<p>How would I setup the Service Worker if all of my requests were via WebSockets?</p>