Lesson

Send Mocked WebSocket Client Messages to the Original Server with MSW

Send mocked WebSocket client messages to the original WebSocket server using Mock Service Worker.

Access
Included
Transcript
Needs source

The WebSocket client events are also being forwarded to the original WebSocket server since we've called server.connect(). Luckily, to opt-out from this forwarding we have to do just the same—call event.preventDefault() on any client event we don't want to be forwarded to the server.

Resources