Course lesson

Modify WebSocket Client Events with Mock Service Worker

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

Duration
1 min
Access
Free
Transcript
Needs source

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