Lesson

Close a WebSocket Client Connection with Mock Service Worker

Close an intercepted WebSocket client via `client.close()` in Mock Service Worker.

Access
Included
Transcript
Needs source

Let's see how our WebSocket client reacts to the connection being closed. Use the client.close() method in the event handler to reliably reproduce client connection closures.

Resources