Package tigase.server.websocket
Class WebSocketHybi
java.lang.Object
tigase.server.websocket.WebSocketHybi
- All Implemented Interfaces:
WebSocketProtocolIfc
@Bean(name="hybiProtocol",
parent=WebSocketClientConnectionManager.class,
active=true)
public class WebSocketHybi
extends Object
implements WebSocketProtocolIfc
Class implements Hybi (RFC compatible) version of WebSocket protocol specification which is used in connection
handshaking as well as in frameing/deframing of data sent over WebSocket connection
- Author:
- andrzej
- See Also:
-
Field Summary
FieldsFields inherited from interface tigase.server.websocket.WebSocketProtocolIfc
WS_PROTOCOL_KEY, WS_VERSION_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseConnection(WebSocketXMPPIOService service) Method closes connection by sending close framedecodeFrame(WebSocketXMPPIOService service, ByteBuffer buf) Method responsible for decoding data received from socket and returning data after extracting it from WebSocket frame.voidencodeFrameAndWrite(WebSocketXMPPIOService service, ByteBuffer buf) Method encodes data into WebSocket frame and writes it to passed servicegetId()Method to retrieve string identifier of implementation of protcol versionbooleanhandshake(WebSocketXMPPIOService service, Map<String, String> headers, byte[] buf) Method responsible for handshaking of WebSocket using proper version of protocol.
-
Field Details
-
ID
- See Also:
-
-
Constructor Details
-
WebSocketHybi
public WebSocketHybi()
-
-
Method Details
-
getId
Description copied from interface:WebSocketProtocolIfcMethod to retrieve string identifier of implementation of protcol version- Specified by:
getIdin interfaceWebSocketProtocolIfc
-
handshake
public boolean handshake(WebSocketXMPPIOService service, Map<String, String> headers, byte[] buf) throws NoSuchAlgorithmException, IOExceptionDescription copied from interface:WebSocketProtocolIfcMethod responsible for handshaking of WebSocket using proper version of protocol.- Specified by:
handshakein interfaceWebSocketProtocolIfc- Returns:
- false - if implementation is not able to handshake using this version of protocol, in other case return true
- Throws:
NoSuchAlgorithmExceptionIOException
-
decodeFrame
Description copied from interface:WebSocketProtocolIfcMethod responsible for decoding data received from socket and returning data after extracting it from WebSocket frame.- Specified by:
decodeFramein interfaceWebSocketProtocolIfc- Returns:
- decoded data or null if not full frame is available in input buffer
-
encodeFrameAndWrite
Description copied from interface:WebSocketProtocolIfcMethod encodes data into WebSocket frame and writes it to passed service- Specified by:
encodeFrameAndWritein interfaceWebSocketProtocolIfc- Throws:
IOException
-
closeConnection
Description copied from interface:WebSocketProtocolIfcMethod closes connection by sending close frame- Specified by:
closeConnectionin interfaceWebSocketProtocolIfc
-