WebSocket 1003 Unsupported Data vs 1005 No Status Received
Both WebSocket 1003 (Unsupported Data) and 1005 (No Status Received) belong to the WebSocket Close Codes category. 1003 indicates that an endpoint received a type of data it cannot accept. For example, a text-only endpoint received a binary message, or vice versa. Meanwhile, 1005 means that a reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame.
คำอธิบาย
An endpoint received a type of data it cannot accept. For example, a text-only endpoint received a binary message, or vice versa.
เมื่อคุณพบเห็น
The client sent a binary frame to a server that only handles text, or a text frame to a binary-only endpoint. The receiver does not know how to process this data type.
วิธีแก้ไข
Verify the message type (text vs binary) matches what the server expects. Update your client to send the correct opcode for the data format.
คำอธิบาย
A reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame.
เมื่อคุณพบเห็น
The peer closed the connection with a Close frame that contained no status code payload. Your WebSocket library surfaces 1005 as a sentinel to indicate the absence of a code.
วิธีแก้ไข
This is an internal indicator, not a wire protocol value. If you see it frequently, the remote peer may have a bug where it sends empty Close frames — check the peer's implementation.
ความแตกต่างหลัก
WebSocket 1003: An endpoint received a type of data it cannot accept. For example, a text-only endpoint received a binary message, or vice versa.
WebSocket 1005: A reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame.
You encounter 1003 when the client sent a binary frame to a server that only handles text, or a text frame to a binary-only endpoint. The receiver does not know how to process this data type.
You encounter 1005 when the peer closed the connection with a Close frame that contained no status code payload. Your WebSocket library surfaces 1005 as a sentinel to indicate the absence of a code.
ควรใช้อันไหนเมื่อไร
For 1003 (Unsupported Data): Verify the message type (text vs binary) matches what the server expects. Update your client to send the correct opcode for the data format. For 1005 (No Status Received): This is an internal indicator, not a wire protocol value. If you see it frequently, the remote peer may have a bug where it sends empty Close frames — check the peer's implementation.