Package tigase.server.websocket
Class WebSocketHixie76
- java.lang.Object
-
- tigase.server.websocket.WebSocketHixie76
-
- All Implemented Interfaces:
WebSocketProtocolIfc
@Bean(name="hyxie76Protocol", parent=WebSocketClientConnectionManager.class, active=false) public class WebSocketHixie76 extends java.lang.Object implements WebSocketProtocolIfc
Class implements Hixie-76 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:
- WebSocket Hixie-76 specification
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringID-
Fields inherited from interface tigase.server.websocket.WebSocketProtocolIfc
WS_PROTOCOL_KEY, WS_VERSION_KEY
-
-
Constructor Summary
Constructors Constructor Description WebSocketHixie76()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection(WebSocketXMPPIOService service)Method closes connection by sending close framejava.nio.ByteBufferdecodeFrame(WebSocketXMPPIOService service, java.nio.ByteBuffer buf)Method responsible for decoding data received from socket and returning data after extracting it from WebSocket frame.voidencodeFrameAndWrite(WebSocketXMPPIOService service, java.nio.ByteBuffer buf)Method encodes data into WebSocket frame and writes it to passed servicejava.lang.StringgetId()Method to retrieve string identifier of implementation of protcol versionbooleanhandshake(WebSocketXMPPIOService service, java.util.Map<java.lang.String,java.lang.String> headers, byte[] buf)Method responsible for handshaking of WebSocket using proper version of protocol.
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public java.lang.String 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, java.util.Map<java.lang.String,java.lang.String> headers, byte[] buf) throws java.security.NoSuchAlgorithmException, java.io.IOException
Description 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:
java.security.NoSuchAlgorithmExceptionjava.io.IOException
-
decodeFrame
public java.nio.ByteBuffer decodeFrame(WebSocketXMPPIOService service, java.nio.ByteBuffer buf)
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
public void encodeFrameAndWrite(WebSocketXMPPIOService service, java.nio.ByteBuffer buf) throws java.io.IOException
Description copied from interface:WebSocketProtocolIfcMethod encodes data into WebSocket frame and writes it to passed service- Specified by:
encodeFrameAndWritein interfaceWebSocketProtocolIfc- Throws:
java.io.IOException
-
closeConnection
public void closeConnection(WebSocketXMPPIOService service)
Description copied from interface:WebSocketProtocolIfcMethod closes connection by sending close frame- Specified by:
closeConnectionin interfaceWebSocketProtocolIfc
-
-