Package org.java_websocket.drafts
Class Draft_6455
- java.lang.Object
-
- org.java_websocket.drafts.Draft
-
- org.java_websocket.drafts.Draft_6455
-
public class Draft_6455 extends Draft
Implementation for the RFC 6455 websocket protocol This is the recommended class for your websocket connection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.java_websocket.drafts.Draft
Draft.CloseHandshakeType, Draft.HandshakeState
-
-
Field Summary
-
Fields inherited from class org.java_websocket.drafts.Draft
continuousFrameType, INITIAL_FAMESIZE, MAX_FAME_SIZE, role
-
-
Constructor Summary
Constructors Constructor Description Draft_6455()Constructor for the websocket protocol specified by RFC 6455 with default extensionsDraft_6455(java.util.List<IExtension> inputExtensions)Constructor for the websocket protocol specified by RFC 6455 with custom extensionsDraft_6455(java.util.List<IExtension> inputExtensions, java.util.List<IProtocol> inputProtocols)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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Draft.HandshakeStateacceptHandshakeAsClient(ClientHandshake request, ServerHandshake response)Draft.HandshakeStateacceptHandshakeAsServer(ClientHandshake handshakedata)DraftcopyInstance()Drafts must only be by one websocket at all.java.nio.ByteBuffercreateBinaryFrame(Framedata framedata)java.util.List<Framedata>createFrames(java.lang.String text, boolean mask)java.util.List<Framedata>createFrames(java.nio.ByteBuffer binary, boolean mask)booleanequals(java.lang.Object o)Draft.CloseHandshakeTypegetCloseHandshakeType()IExtensiongetExtension()Getter for the extension which is used by this draftjava.util.List<IExtension>getKnownExtensions()Getter for all available extensions for this draftjava.util.List<IProtocol>getKnownProtocols()Getter for all available protocols for this draftIProtocolgetProtocol()Getter for the protocol which is used by this draftinthashCode()ClientHandshakeBuilderpostProcessHandshakeRequestAsClient(ClientHandshakeBuilder request)HandshakeBuilderpostProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response)voidprocessFrame(WebSocketImpl webSocketImpl, Framedata frame)Handle the frame specific to the draftvoidreset()java.lang.StringtoString()java.util.List<Framedata>translateFrame(java.nio.ByteBuffer buffer)FramedatatranslateSingleFrame(java.nio.ByteBuffer buffer)-
Methods inherited from class org.java_websocket.drafts.Draft
basicAccept, checkAlloc, continuousFrame, createHandshake, createHandshake, getRole, readLine, readStringLine, setParseMode, translateHandshake, translateHandshakeHttp
-
-
-
-
Constructor Detail
-
Draft_6455
public Draft_6455()
Constructor for the websocket protocol specified by RFC 6455 with default extensions- Since:
- 1.3.5
-
Draft_6455
public Draft_6455(IExtension inputExtension)
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
public Draft_6455(java.util.List<IExtension> inputExtensions)
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
public Draft_6455(java.util.List<IExtension> inputExtensions, java.util.List<IProtocol> inputProtocols)
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
-
-
Method Detail
-
acceptHandshakeAsServer
public Draft.HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException
- Specified by:
acceptHandshakeAsServerin classDraft- Throws:
InvalidHandshakeException
-
acceptHandshakeAsClient
public Draft.HandshakeState acceptHandshakeAsClient(ClientHandshake request, ServerHandshake response) throws InvalidHandshakeException
- Specified by:
acceptHandshakeAsClientin classDraft- Throws:
InvalidHandshakeException
-
getExtension
public IExtension 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
public java.util.List<IExtension> getKnownExtensions()
Getter for all available extensions for this draft- Returns:
- the extensions which are enabled for this draft
-
getProtocol
public IProtocol 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
-
getKnownProtocols
public java.util.List<IProtocol> getKnownProtocols()
Getter for all available protocols for this draft- Returns:
- the protocols which are enabled for this draft
- Since:
- 1.3.7
-
postProcessHandshakeRequestAsClient
public ClientHandshakeBuilder postProcessHandshakeRequestAsClient(ClientHandshakeBuilder request)
- Specified by:
postProcessHandshakeRequestAsClientin classDraft
-
postProcessHandshakeResponseAsServer
public HandshakeBuilder postProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response) throws InvalidHandshakeException
- Specified by:
postProcessHandshakeResponseAsServerin classDraft- Throws:
InvalidHandshakeException
-
copyInstance
public Draft copyInstance()
Description copied from class:DraftDrafts 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:
copyInstancein classDraft- Returns:
- a copy of the draft
-
createBinaryFrame
public java.nio.ByteBuffer createBinaryFrame(Framedata framedata)
- Specified by:
createBinaryFramein classDraft
-
translateSingleFrame
public Framedata translateSingleFrame(java.nio.ByteBuffer buffer) throws IncompleteException, InvalidDataException
-
translateFrame
public java.util.List<Framedata> translateFrame(java.nio.ByteBuffer buffer) throws InvalidDataException
- Specified by:
translateFramein classDraft- Throws:
InvalidDataException
-
createFrames
public java.util.List<Framedata> createFrames(java.nio.ByteBuffer binary, boolean mask)
- Specified by:
createFramesin classDraft
-
createFrames
public java.util.List<Framedata> createFrames(java.lang.String text, boolean mask)
- Specified by:
createFramesin classDraft
-
processFrame
public void processFrame(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException
Description copied from class:DraftHandle the frame specific to the draft- Specified by:
processFramein 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
public Draft.CloseHandshakeType getCloseHandshakeType()
- Specified by:
getCloseHandshakeTypein classDraft
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-