> On 2 Jun 2016, at 13:00, Simone Bordet <simone.bor...@gmail.com> wrote: > > Furthermore, I'm not convinced there should be a parameterless sendClose(). > The WebSocket protocol itself *mandates* that the Close message must > have a code
Regardless of your API proposal, where did you find that in the RFC? Here's what I see: 7.4. Status Codes When closing an established connection (e.g., when sending a Close frame, after the opening handshake has completed), an endpoint MAY indicate a reason for closure. The interpretation of this reason by an endpoint, and the action an endpoint should take given this reason, are left undefined by this specification. This specification defines a set of pre-defined status codes and specifies which ranges may be used by extensions, frameworks, and end applications. *The status code and any associated textual message are optional components of a Close frame.* ... 5.5.1. Close The Close frame contains an opcode of 0x8. *The Close frame MAY contain a body (the "Application data" portion of the frame)* that indicates a reason for closing, such as an endpoint shutting down, an endpoint having received a frame too large, or an endpoint having received a frame that does not conform to the format expected by the endpoint. If there is a body, the first two bytes of the body MUST be a 2-byte unsigned integer...