Package org.java_websocket.drafts
Class Draft_6455
java.lang.Object
org.java_websocket.drafts.Draft
org.java_websocket.drafts.Draft_6455
Implementation for the RFC 6455 websocket protocol This is the recommended class for your
websocket connection
-
Field Summary
Fields inherited from class org.java_websocket.drafts.Draft
continuousFrameType, role
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the websocket protocol specified by RFC 6455 with default extensionsDraft_6455
(List<IExtension> inputExtensions) Constructor for the websocket protocol specified by RFC 6455 with custom extensionsDraft_6455
(List<IExtension> inputExtensions, int inputMaxFrameSize) Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocolsDraft_6455
(List<IExtension> inputExtensions, List<IProtocol> inputProtocols) Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocolsDraft_6455
(List<IExtension> inputExtensions, List<IProtocol> inputProtocols, int inputMaxFrameSize) Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocolsDraft_6455
(IExtension inputExtension) Constructor for the websocket protocol specified by RFC 6455 with custom extensions -
Method Summary
Modifier and TypeMethodDescriptionacceptHandshakeAsClient
(ClientHandshake request, ServerHandshake response) acceptHandshakeAsServer
(ClientHandshake handshakedata) Drafts must only be by one websocket at all.createBinaryFrame
(Framedata framedata) createFrames
(String text, boolean mask) createFrames
(ByteBuffer binary, boolean mask) boolean
Getter for the extension which is used by this draftGetter for all available extensions for this draftGetter for all available protocols for this draftint
Getter for the maximum allowed payload size which is used by this draftGetter for the protocol which is used by this draftint
hashCode()
postProcessHandshakeResponseAsServer
(ClientHandshake request, ServerHandshakeBuilder response) void
processFrame
(WebSocketImpl webSocketImpl, Framedata frame) Handle the frame specific to the draftvoid
reset()
toString()
translateFrame
(ByteBuffer buffer) Methods inherited from class org.java_websocket.drafts.Draft
basicAccept, checkAlloc, continuousFrame, createHandshake, createHandshake, createHandshake, createHandshake, getRole, readLine, readStringLine, setParseMode, translateHandshake, translateHandshakeHttp
-
Constructor Details
-
Draft_6455
public Draft_6455()Constructor for the websocket protocol specified by RFC 6455 with default extensions- Since:
- 1.3.5
-
Draft_6455
Constructor for the websocket protocol specified by RFC 6455 with custom extensions- Parameters:
inputExtension
- the extension which should be used for this draft- Since:
- 1.3.5
-
Draft_6455
Constructor for the websocket protocol specified by RFC 6455 with custom extensions- Parameters:
inputExtensions
- the extensions which should be used for this draft- Since:
- 1.3.5
-
Draft_6455
Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols- Parameters:
inputExtensions
- the extensions which should be used for this draftinputProtocols
- the protocols which should be used for this draft- Since:
- 1.3.7
-
Draft_6455
Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols- Parameters:
inputExtensions
- the extensions which should be used for this draftinputMaxFrameSize
- the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)- Since:
- 1.4.0
-
Draft_6455
public Draft_6455(List<IExtension> inputExtensions, List<IProtocol> inputProtocols, int inputMaxFrameSize) Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols- Parameters:
inputExtensions
- the extensions which should be used for this draftinputProtocols
- the protocols which should be used for this draftinputMaxFrameSize
- the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)- Since:
- 1.4.0
-
-
Method Details
-
acceptHandshakeAsServer
public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException - Specified by:
acceptHandshakeAsServer
in classDraft
- Throws:
InvalidHandshakeException
-
acceptHandshakeAsClient
public HandshakeState acceptHandshakeAsClient(ClientHandshake request, ServerHandshake response) throws InvalidHandshakeException - Specified by:
acceptHandshakeAsClient
in classDraft
- Throws:
InvalidHandshakeException
-
getExtension
Getter for the extension which is used by this draft- Returns:
- the extension which is used or null, if handshake is not yet done
-
getKnownExtensions
Getter for all available extensions for this draft- Returns:
- the extensions which are enabled for this draft
-
getProtocol
Getter for the protocol which is used by this draft- Returns:
- the protocol which is used or null, if handshake is not yet done or no valid protocols
- Since:
- 1.3.7
-
getMaxFrameSize
public int getMaxFrameSize()Getter for the maximum allowed payload size which is used by this draft- Returns:
- the size, which is allowed for the payload
- Since:
- 1.4.0
-
getKnownProtocols
Getter for all available protocols for this draft- Returns:
- the protocols which are enabled for this draft
- Since:
- 1.3.7
-
postProcessHandshakeRequestAsClient
- Specified by:
postProcessHandshakeRequestAsClient
in classDraft
-
postProcessHandshakeResponseAsServer
public HandshakeBuilder postProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response) throws InvalidHandshakeException - Specified by:
postProcessHandshakeResponseAsServer
in classDraft
- Throws:
InvalidHandshakeException
-
copyInstance
Description copied from class:Draft
Drafts must only be by one websocket at all. To prevent drafts to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given draft instance.
The copy can be safely used in conjunction with a new websocket connection.- Specified by:
copyInstance
in classDraft
- Returns:
- a copy of the draft
-
createBinaryFrame
- Specified by:
createBinaryFrame
in classDraft
-
translateFrame
- Specified by:
translateFrame
in classDraft
- Throws:
InvalidDataException
-
createFrames
- Specified by:
createFrames
in classDraft
-
createFrames
- Specified by:
createFrames
in classDraft
-
reset
public void reset() -
processFrame
Description copied from class:Draft
Handle the frame specific to the draft- Specified by:
processFrame
in classDraft
- Parameters:
webSocketImpl
- the websocketimpl used for this draftframe
- the frame which is supposed to be handled- Throws:
InvalidDataException
- will be thrown on invalid data
-
getCloseHandshakeType
- Specified by:
getCloseHandshakeType
in classDraft
-
toString
-
equals
-
hashCode
public int hashCode()
-