Modify WebSocket Client Events with Mock Service Worker

Listening to the outgoing WebSocket client events is nice, but how about we modify them?

Let's parse the incoming MessageEvent data using JSON.parse, modify it, and provide its stringified version to the chat.broadcast() call to broadcast a different data.

Resources

Share with a coworker

Transcript