问题
I can't figure out from the WebSocketServer.java source which draft it uses.
The WebSocketClient.java can use RFC 6455, Hybi 17, Hybi 10, Hixie 76, and Hixie 75 yet defaults to RFC 6455.
What draft does java-websocket's WebSocketServer use?
回答1:
It supports whatever drafts you want it to support.
The constructor supports passing in a list of Drafts that you want the server to handle.
https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/server/WebSocketServer.java#L131-L150
Looks like it will always support Version 13 (RFC-6455) even if you pass in an empty Drafts list (as a null list will result in all 4 default Drafts being active), otherwise it has 4 drafts implemented for you to pick / choose / limit from.
https://github.com/TooTallNate/Java-WebSocket/tree/master/src/main/java/org/java_websocket/drafts
- Draft_17 =
Sec-WebSocket-Version: 13
(aka RFC-6455) - Draft_10 =
Sec-WebSocket-Version: 8
- Draft_76 =
Sec-WebSocket-Version
(unspecified, pre-versioning, Hixie-76) - Draft_75 =
Sec-WebSocket-Version
(unspecified, pre-versioning, Hixie-75)
Update: March 2013
As of Jetty 9.x, only RFC6455 (Sec-WebSocket-Version: 13
) is supported. All support for draft versions of WebSocket have been dropped.
来源:https://stackoverflow.com/questions/21035326/what-draft-does-java-websockets-websocketserver-use