001/* 002 * Copyright (C) 2015 Neo Visionaries Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package NeoVisionaries.WebSockets; 017 018 019/** 020 * Close code. 021 * 022 * <EMBED CLASS='external-html' DATA-FILE-ID=LICENSE> 023 * 024 * @see <a href="http://tools.ietf.org/html/rfc6455#section-7.4.1" 025 * >RFC 6455, 7.4.1. Defined Status Codes</a> 026 */ 027public class WebSocketCloseCode 028{ 029 /** 030 * 1000; 031 * <i> 032 * 1000 indicates a normal closure, meaning that the purpose for 033 * which the connection was established has been fulfilled 034 * </i> 035 */ 036 public static final int NORMAL = 1000; 037 038 039 /** 040 * 1001; 041 * <i> 042 * 1001 indicates that an endpoint is "going away", such as a server 043 * going down or a browser having navigated away from a page 044 * </i> 045 */ 046 public static final int AWAY = 1001; 047 048 049 /** 050 * 1002; 051 * <i> 052 * 1002 indicates that an endpoint is terminating the connection due 053 * to a protocol error 054 * </i> 055 */ 056 public static final int UNCONFORMED = 1002; 057 058 059 /** 060 * 1003; 061 * <i> 062 * 1003 indicates that an endpoint is terminating the connection 063 * because it has received a type of data it cannot accept 064 * (e.g., an endpoint that understands only text data MAY 065 * send this if it receives a binary message) 066 * </i> 067 */ 068 public static final int UNACCEPTABLE = 1003; 069 070 071 /** 072 * 1005; 073 * <i> 074 * 1005 is a reserved value and MUST NOT be set as a status code in a 075 * Close control frame by an endpoint. It is designated for use in 076 * applications expecting a status code to indicate that no status 077 * code was actually present 078 * </i> 079 */ 080 public static final int NONE = 1005; 081 082 083 /** 084 * 1006; 085 * <i> 086 * 1006 is a reserved value and MUST NOT be set as a status code in a 087 * Close control frame by an endpoint. It is designated for use in 088 * applications expecting a status code to indicate that the 089 * connection was closed abnormally, e.g., without sending or 090 * receiving a Close control frame 091 * </i> 092 */ 093 public static final int ABNORMAL = 1006; 094 095 096 /** 097 * 1007; 098 * <i> 099 * 1007 indicates that an endpoint is terminating the connection 100 * because it has received data within a message that was not 101 * consistent with the type of the message (e.g., non-UTF-8 102 * [<a href="http://tools.ietf.org/html/rfc3629">RFC3629</a>] data 103 * within a text message) 104 * </i> 105 */ 106 public static final int INCONSISTENT = 1007; 107 108 109 /** 110 * 1008; 111 * <i> 112 * 1008 indicates that an endpoint is terminating the connection 113 * because it has received a message that violates its policy. 114 * This is a generic status code that can be returned when there 115 * is no other more suitable status code (e.g., 1003 or 1009) 116 * or if there is a need to hide specific details about the policy 117 * </i> 118 */ 119 public static final int VIOLATED = 1008; 120 121 122 /** 123 * 1009; 124 * <i> 125 * 1009 indicates that an endpoint is terminating the connection 126 * because it has received a message that is too big for it to 127 * process 128 * </i> 129 */ 130 public static final int OVERSIZE = 1009; 131 132 133 /** 134 * 1010; 135 * <i> 136 * 1010 indicates that an endpoint (client) is terminating the 137 * connection because it has expected the server to negotiate 138 * one or more extension, but the server didn't return them in 139 * the response message of the WebSocket handshake. The 140 * list of extensions that are needed SHOULD appear in the 141 * /reason/ part of the Close frame. Note that this status 142 * code is not used by the server, because it can fail the 143 * WebSocket handshake instead 144 * </i> 145 */ 146 public static final int UNEXTENDED = 1010; 147 148 149 /** 150 * 1011; 151 * <i> 152 * 1011 indicates that a server is terminating the connection because 153 * it encountered an unexpected condition that prevented it from 154 * fulfilling the request 155 * </i> 156 */ 157 public static final int UNEXPECTED = 1011; 158 159 160 /** 161 * 1015; 162 * <i> 163 * 1015 is a reserved value and MUST NOT be set as a status code in a 164 * Close control frame by an endpoint. It is designated for use in 165 * applications expecting a status code to indicate that the 166 * connection was closed due to a failure to perform a TLS handshake 167 * (e.g., the server certificate can't be verified) 168 * </i> 169 */ 170 public static final int INSECURE = 1015; 171 172 173 private WebSocketCloseCode() 174 { 175 } 176}