public class Handshaker extends Object implements IHandshaker
Constructor and Description |
---|
Handshaker(IWebSocketSessionConfig config,
boolean clientMode)
Constructs the handshaker.
|
Modifier and Type | Method and Description |
---|---|
String |
getClosingReason()
Returns a detailed reason why the handshake phase could not finished
successfully.
|
IExtension |
getExtension(String name)
Returns the negotiated extension identified by the specified name.
|
String[] |
getExtensionNames()
Returns the names of all extensions that have been negotiated
|
IExtension[] |
getExtensions()
Returns all extensions that have been negotiated
|
String |
getSubProtocol()
Return the negotiated sub-protocol.
|
URI |
getUri()
The URI identifying the Web Socket connection for both the client and
server sessions.
|
HandshakeFrame |
handshake()
Initiates the handshake phase by Web Socket clients.
|
HandshakeFrame |
handshake(HandshakeFrame frame)
Processes the handshake frame received from a Web Socket client.
|
boolean |
hasExtensions()
Tells is any extension has been negotiated
|
boolean |
isClientMode()
Tells the mode (server/client) this handshaker is operating
|
boolean |
isClosing()
Tells if this handshake is closing without successfully finishing the
handshake phase.
|
boolean |
isFinished()
Tells if this handshake has successfully finished the handshake phase.
|
void |
setSession(ISession session)
Sets the session object this handshaker is associated with.
|
void |
updateExtensionDecoders(ICodecPipeline pipeline)
Called to updated the pipeline decoders based on the negotiated extensions
|
void |
updateExtensionEncoders(ICodecPipeline pipeline)
Called to updated the pipeline encoders based on the negotiated extensions
|
public Handshaker(IWebSocketSessionConfig config, boolean clientMode)
config
- the Web Socket configuration of the session this
handshaker should be associated withclientMode
- the mode in witch this handshaker should operatepublic void setSession(ISession session)
IHandshaker
setSession
in interface IHandshaker
session
- the session objectpublic boolean isClientMode()
IHandshaker
isClientMode
in interface IHandshaker
true
if this handshaker is operating in the client modepublic boolean isFinished()
IHandshaker
isFinished
in interface IHandshaker
true
if the handshake phase has been successfully finishedpublic boolean isClosing()
IHandshaker
isClosing
in interface IHandshaker
true
if this handshaker is closingpublic String getSubProtocol()
IHandshaker
getSubProtocol
in interface IHandshaker
null
if no sub-protocol has
been negotiated.public boolean hasExtensions()
IHandshaker
hasExtensions
in interface IHandshaker
true
if at least one extension has been negotiatedpublic IExtension getExtension(String name)
IHandshaker
getExtension
in interface IHandshaker
name
- the name of the extension to returnnull
if no extension with specified name has
been negotiatedpublic IExtension[] getExtensions()
IHandshaker
getExtensions
in interface IHandshaker
public String[] getExtensionNames()
IHandshaker
getExtensionNames
in interface IHandshaker
public void updateExtensionEncoders(ICodecPipeline pipeline)
IHandshaker
updateExtensionEncoders
in interface IHandshaker
pipeline
- the pipeline to be updatedpublic void updateExtensionDecoders(ICodecPipeline pipeline)
IHandshaker
updateExtensionDecoders
in interface IHandshaker
pipeline
- the pipeline to be updatedpublic URI getUri()
IHandshaker
getUri
in interface IHandshaker
public String getClosingReason()
IHandshaker
getClosingReason
in interface IHandshaker
public HandshakeFrame handshake()
IHandshaker
handshake
in interface IHandshaker
public HandshakeFrame handshake(HandshakeFrame frame) throws InvalidHandshakeException
IHandshaker
handshake
in interface IHandshaker
frame
- the received handshake frameInvalidHandshakeException
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.