Lesson
Use a Custom Close Code to Close a WebSocket Connection with MSW
Close a WebSocket client connection with a custom, non-configurable close code using Mock Service Worker.
- Access
- Included
- Transcript
- Needs source
With MSW, you can use custom close codes that are otherwise unusable on the client. For example, in this lesson we will emulate a WebSocket connection closure due to a 1003 status code, which means that the server is unable to process the incoming data.