Lesson

Prevent WebSocket Server Close Event with MSW

Prevent original WebSocket server closures with Mock Service Worker.

Access
Included
Transcript
Needs source

Sicne we're involving an actual WebSocket server in our mock, what happens if that server disconnects? Well, the client connection will close, which is a bummer. Let's see how to listen and prevent original server's close event, and also conditionally fallback to MSW to act as the server if that happens.

Resources