An overview of the
This article is chapter 8 of WebSocket protocol. The main content of this article is WebSocket error handling.
Those interested in the previous chapters of this document can see:
- WebSocket Protocol — Abstract
- WebSocket Protocol Chapter 1 — Introduction
- WebSocket Protocol Chapter 2 — Conformance Requirements
- WebSocket Protocol chapter 3 — WebSocket URIs
- WebSocket Protocol chapter 4 — Opening Handshake
- WebSocket Protocol Chapter 5 — Data Framing
- Chapter 6 of the WebSocket Protocol — Sending and Receiving Data
- WebSocket Protocol Chapter 7 — Closing the Connection
Error handling (Protocol body)
8.1 Handling UTF-8 Data Errors
When an endpoint parses a byte stream in UTF-8 format and finds that the byte stream is not a UTF-8 encoding or a valid UTF-8 byte stream, the endpoint must close the WebSocket connection. This rule applies at the beginning of a connection handshake and at subsequent data exchanges.