1 /* 2 * Copyright 2012 The Netty Project 3 * 4 * The Netty Project licenses this file to you under the Apache License, 5 * version 2.0 (the "License"); you may not use this file except in compliance 6 * with the License. You may obtain a copy of the License at: 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 package org.jboss.netty.handler.codec.http.websocketx; 17 18 /** 19 * <p> 20 * Versions of the web socket specification. 21 * </p> 22 * <p> 23 * A specification is tied to one wire protocol version but a protocol version may have use by more than 1 version of 24 * the specification. 25 * </p> 26 */ 27 public enum WebSocketVersion { 28 UNKNOWN, 29 30 /** 31 * <a href= "http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00" 32 * >draft-ietf-hybi-thewebsocketprotocol- 00</a>. 33 */ 34 V00, 35 36 /** 37 * <a href= "http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10" 38 * >draft-ietf-hybi-thewebsocketprotocol- 10</a> 39 */ 40 V08, 41 42 /** 43 * <a href="http://tools.ietf.org/html/rfc6455 ">RFC 6455</a>. This was originally <a href= 44 * "http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17" >draft-ietf-hybi-thewebsocketprotocol- 45 * 17</a> 46 */ 47 V13; 48 49 /** 50 * @return Value for HTTP Header 'Sec-WebSocket-Version' 51 */ 52 public String toHttpHeaderValue() { 53 if (this == V00) { 54 return "0"; 55 } else if (this == V08) { 56 return "8"; 57 } else if (this == V13) { 58 return "13"; 59 } 60 throw new IllegalStateException("Unknown web socket version: " + this); 61 } 62 }