WebSocket 1000 Normal Closure vs 1009 Message Too Big
Both WebSocket 1000 (Normal Closure) and 1009 (Message Too Big) belong to the WebSocket Close Codes category. 1000 indicates that the connection has been closed cleanly, meaning the purpose for which it was established has been fulfilled. Both endpoints agree the session is complete. Meanwhile, 1009 means that an endpoint is terminating the connection because it received a message that is too large for it to process.
Mô tả
The connection has been closed cleanly, meaning the purpose for which it was established has been fulfilled. Both endpoints agree the session is complete.
Khi bạn thấy mã này
The WebSocket connection closed gracefully after both sides finished exchanging data. This is the expected close code for a successful session.
Cách khắc phục
No fix needed — this indicates everything worked as intended. If you did not expect the connection to close, check your application logic for premature close() calls.
Mô tả
An endpoint is terminating the connection because it received a message that is too large for it to process.
Khi bạn thấy mã này
The message payload exceeded the server's configured maximum frame or message size limit. Common when uploading large files or sending huge JSON payloads over WebSocket.
Cách khắc phục
Reduce the message size by chunking large payloads into smaller frames. Alternatively, increase the server's max message size configuration if the large payload is expected.
Sự khác biệt chính
WebSocket 1000: The connection has been closed cleanly, meaning the purpose for which it was established has been fulfilled. Both endpoints agree the session is complete.
WebSocket 1009: An endpoint is terminating the connection because it received a message that is too large for it to process.
You encounter 1000 when the WebSocket connection closed gracefully after both sides finished exchanging data. This is the expected close code for a successful session.
You encounter 1009 when the message payload exceeded the server's configured maximum frame or message size limit. Common when uploading large files or sending huge JSON payloads over WebSocket.
Khi nào dùng cái nào
For 1000 (Normal Closure): No fix needed — this indicates everything worked as intended. If you did not expect the connection to close, check your application logic for premature close() calls. For 1009 (Message Too Big): Reduce the message size by chunking large payloads into smaller frames. Alternatively, increase the server's max message size configuration if the large payload is expected.