Lesson

Prevent WebSocket Event Propagation Between Listeners with MSW

Control WebSocket event propagation between different listeners with Mock Service Worker.

Access
Included
Transcript
Needs source

Mocking WebSocket APIs resembles how you use them in the actual code. This means that you can control the event flow for your client and server events as you normally would when using EventTarget. Let's explore how to use event.stopPropagation() and event.stopImmediatePropagation() to achieve behavior layering when mocking WebSocket events.

Resources