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(List<IExtension> inputExtensions)
Constructor for the websocket protocol specified by RFC 6455 with custom extensionsDraft_6455(List<IExtension> inputExtensions, 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
-
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(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(List<IExtension> inputExtensions, 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:
acceptHandshakeAsServer
in classDraft
- Throws:
InvalidHandshakeException
-
acceptHandshakeAsClient
public Draft.HandshakeState acceptHandshakeAsClient(ClientHandshake request, ServerHandshake response) throws InvalidHandshakeException
- Specified by:
acceptHandshakeAsClient
in 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 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 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:
postProcessHandshakeRequestAsClient
in classDraft
-
postProcessHandshakeResponseAsServer
public HandshakeBuilder postProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response) throws InvalidHandshakeException
- Specified by:
postProcessHandshakeResponseAsServer
in classDraft
- Throws:
InvalidHandshakeException
-
copyInstance
public Draft 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
public ByteBuffer createBinaryFrame(Framedata framedata)
- Specified by:
createBinaryFrame
in classDraft
-
translateSingleFrame
public Framedata translateSingleFrame(ByteBuffer buffer) throws IncompleteException, InvalidDataException
-
translateFrame
public List<Framedata> translateFrame(ByteBuffer buffer) throws InvalidDataException
- Specified by:
translateFrame
in classDraft
- Throws:
InvalidDataException
-
createFrames
public List<Framedata> createFrames(ByteBuffer binary, boolean mask)
- Specified by:
createFrames
in classDraft
-
createFrames
public List<Framedata> createFrames(String text, boolean mask)
- Specified by:
createFrames
in classDraft
-
processFrame
public void processFrame(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException
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
public Draft.CloseHandshakeType getCloseHandshakeType()
- Specified by:
getCloseHandshakeType
in classDraft
-
-