|
4 | 4 | import org.java_websocket.exceptions.InvalidFrameException; |
5 | 5 |
|
6 | 6 | public interface CloseFrame extends Framedata { |
7 | | - /** |
8 | | - * indicates a normal closure, meaning whatever purpose the |
9 | | - * connection was established for has been fulfilled. |
10 | | - */ |
11 | | - public static final int NORMAL = 1000; |
12 | | - /** |
13 | | - * 1001 indicates that an endpoint is "going away", such as a server |
14 | | - * going down, or a browser having navigated away from a page. |
15 | | - */ |
16 | | - public static final int GOING_AWAY = 1001; |
17 | | - /** |
18 | | - * 1002 indicates that an endpoint is terminating the connection due |
19 | | - * to a protocol error. |
20 | | - */ |
21 | | - public static final int PROTOCOL_ERROR = 1002; |
22 | | - /** |
23 | | - * 1003 indicates that an endpoint is terminating the connection |
24 | | - * because it has received a type of data it cannot accept (e.g. an |
25 | | - * endpoint that understands only text data MAY send this if it |
26 | | - * receives a binary message). |
27 | | - */ |
28 | | - public static final int REFUSE = 1003; |
29 | | - /*1004: Reserved. The specific meaning might be defined in the future.*/ |
30 | | - /** |
31 | | - * 1005 is a reserved value and MUST NOT be set as a status code in a |
32 | | - * Close control frame by an endpoint. It is designated for use in |
33 | | - * applications expecting a status code to indicate that no status |
34 | | - * code was actually present. |
35 | | - */ |
36 | | - public static final int NOCODE = 1005; |
37 | | - /** |
38 | | - * 1006 is a reserved value and MUST NOT be set as a status code in a |
39 | | - * Close control frame by an endpoint. It is designated for use in |
40 | | - * applications expecting a status code to indicate that the |
41 | | - * connection was closed abnormally, e.g. without sending or |
42 | | - * receiving a Close control frame. |
43 | | - */ |
44 | | - public static final int ABNORMAL_CLOSE = 1006; |
45 | | - /** |
46 | | - * 1007 indicates that an endpoint is terminating the connection |
47 | | - * because it has received data within a message that was not |
48 | | - * consistent with the type of the message (e.g., non-UTF-8 [RFC3629] |
49 | | - * data within a text message). |
50 | | - */ |
51 | | - public static final int NO_UTF8 = 1007; |
52 | | - /** |
53 | | - * 1008 indicates that an endpoint is terminating the connection |
54 | | - * because it has received a message that violates its policy. This |
55 | | - * is a generic status code that can be returned when there is no |
56 | | - * other more suitable status code (e.g. 1003 or 1009), or if there |
57 | | - * is a need to hide specific details about the policy. |
58 | | - */ |
59 | | - public static final int POLICY_VALIDATION = 1008; |
60 | | - /** |
61 | | - * 1009 indicates that an endpoint is terminating the connection |
62 | | - * because it has received a message which is too big for it to |
63 | | - * process. |
64 | | - */ |
65 | | - public static final int TOOBIG = 1009; |
66 | | - /** |
67 | | - * 1010 indicates that an endpoint (client) is terminating the |
68 | | - * connection because it has expected the server to negotiate one or |
69 | | - * more extension, but the server didn't return them in the response |
70 | | - * message of the WebSocket handshake. The list of extensions which |
71 | | - * are needed SHOULD appear in the /reason/ part of the Close frame. |
72 | | - * Note that this status code is not used by the server, because it |
73 | | - * can fail the WebSocket handshake instead. |
74 | | - */ |
| 7 | + /** |
| 8 | + * indicates a normal closure, meaning whatever purpose the |
| 9 | + * connection was established for has been fulfilled. |
| 10 | + */ |
| 11 | + public static final int NORMAL = 1000; |
| 12 | + /** |
| 13 | + * 1001 indicates that an endpoint is "going away", such as a server |
| 14 | + * going down, or a browser having navigated away from a page. |
| 15 | + */ |
| 16 | + public static final int GOING_AWAY = 1001; |
| 17 | + /** |
| 18 | + * 1002 indicates that an endpoint is terminating the connection due |
| 19 | + * to a protocol error. |
| 20 | + */ |
| 21 | + public static final int PROTOCOL_ERROR = 1002; |
| 22 | + /** |
| 23 | + * 1003 indicates that an endpoint is terminating the connection |
| 24 | + * because it has received a type of data it cannot accept (e.g. an |
| 25 | + * endpoint that understands only text data MAY send this if it |
| 26 | + * receives a binary message). |
| 27 | + */ |
| 28 | + public static final int REFUSE = 1003; |
| 29 | + /*1004: Reserved. The specific meaning might be defined in the future.*/ |
| 30 | + /** |
| 31 | + * 1005 is a reserved value and MUST NOT be set as a status code in a |
| 32 | + * Close control frame by an endpoint. It is designated for use in |
| 33 | + * applications expecting a status code to indicate that no status |
| 34 | + * code was actually present. |
| 35 | + */ |
| 36 | + public static final int NOCODE = 1005; |
| 37 | + /** |
| 38 | + * 1006 is a reserved value and MUST NOT be set as a status code in a |
| 39 | + * Close control frame by an endpoint. It is designated for use in |
| 40 | + * applications expecting a status code to indicate that the |
| 41 | + * connection was closed abnormally, e.g. without sending or |
| 42 | + * receiving a Close control frame. |
| 43 | + */ |
| 44 | + public static final int ABNORMAL_CLOSE = 1006; |
| 45 | + /** |
| 46 | + * 1007 indicates that an endpoint is terminating the connection |
| 47 | + * because it has received data within a message that was not |
| 48 | + * consistent with the type of the message (e.g., non-UTF-8 [RFC3629] |
| 49 | + * data within a text message). |
| 50 | + */ |
| 51 | + public static final int NO_UTF8 = 1007; |
| 52 | + /** |
| 53 | + * 1008 indicates that an endpoint is terminating the connection |
| 54 | + * because it has received a message that violates its policy. This |
| 55 | + * is a generic status code that can be returned when there is no |
| 56 | + * other more suitable status code (e.g. 1003 or 1009), or if there |
| 57 | + * is a need to hide specific details about the policy. |
| 58 | + */ |
| 59 | + public static final int POLICY_VALIDATION = 1008; |
| 60 | + /** |
| 61 | + * 1009 indicates that an endpoint is terminating the connection |
| 62 | + * because it has received a message which is too big for it to |
| 63 | + * process. |
| 64 | + */ |
| 65 | + public static final int TOOBIG = 1009; |
| 66 | + /** |
| 67 | + * 1010 indicates that an endpoint (client) is terminating the |
| 68 | + * connection because it has expected the server to negotiate one or |
| 69 | + * more extension, but the server didn't return them in the response |
| 70 | + * message of the WebSocket handshake. The list of extensions which |
| 71 | + * are needed SHOULD appear in the /reason/ part of the Close frame. |
| 72 | + * Note that this status code is not used by the server, because it |
| 73 | + * can fail the WebSocket handshake instead. |
| 74 | + */ |
75 | 75 | public static final int EXTENSION = 1010; |
| 76 | + /** |
| 77 | + * 1011 indicates that a server is terminating the connection because |
| 78 | + * it encountered an unexpected condition that prevented it from |
| 79 | + * fulfilling the request. |
| 80 | + **/ |
| 81 | + public static final int UNEXPECTED_CONDITION = 1011; |
| 82 | + /** |
| 83 | + * 1015 is a reserved value and MUST NOT be set as a status code in a |
| 84 | + * Close control frame by an endpoint. It is designated for use in |
| 85 | + * applications expecting a status code to indicate that the |
| 86 | + * connection was closed due to a failure to perform a TLS handshake |
| 87 | + * (e.g., the server certificate can't be verified). |
| 88 | + **/ |
| 89 | + public static final int TLS_ERROR = 1015; |
76 | 90 |
|
77 | 91 | /** The connection had never been established */ |
78 | 92 | public static final int NEVERCONNECTED = -1; |
|
0 commit comments