Lesson
Prevent Server-to-client Message Forwarding in MSW
Prevent the default forwarding of the original WebSocket server events in mocks with Mock Service Worker.
- Access
- Included
- Transcript
- Needs source
By default, once we establish the actual WebSocket server connection in the mock, all the server events will be forwarded to the client. You can opt-out from this default behavior by calling event.preventDefault() on any intercepted server event.