Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

egghead.io

Mocking WebSocket APIs with Mock Service Worker

via egghead.io

Overview

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This course teaches how to mock WebSocket client and server APIs with Mock Service Worker. Learners configure interception, manipulate events and messages, enforce type and runtime safety with Zod, and test WebSocket behavior in Vitest and Playwright.

Syllabus

  • Introduction to Mocking WebSocket APIs with Mock Service Worker
  • Install Mock Service Worker (MSW)
  • Set Up Mock Service Worker in the Browser
  • Intercept a WebSocket connection with Mock Service Worker
  • Intercept WebSocket Client Events with Mock Service Worker
  • Broadcast a Mocked Message to All WebSocket Clients
  • Modify WebSocket Client Events with Mock Service Worker
  • Replay a WebSocket Chat Conversation with Mock Service Worker
  • Make a Type-safe and Runtime-safe WebSocket Communication with Zod
  • Close a WebSocket Client Connection with Mock Service Worker
  • Use a Custom Close Code to Close a WebSocket Connection with MSW
  • Close Multiple WebSocket Clients with MSW
  • Establish Actual WebSocket Server Connection with MSW
  • Intercept WebSocket Server Events with MSW
  • Prevent Server-to-client Message Forwarding in MSW
  • Send Mocked WebSocket Client Messages to the Original Server with MSW
  • Prevent WebSocket Server Close Event with MSW
  • Prevent WebSocket Event Propagation Between Listeners with MSW
  • Understand WebSocket Logs in MSW
  • Test WebSockets in Vitest with MSW
  • Test WebSockets in Playwright with MSW
  • Override WebSocket Event Handling in Tests with MSW

Taught by

Artem Zakharchenko

Reviews

Start your review of Mocking WebSocket APIs with Mock Service Worker

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.