Class WebSocketComm
- All Implemented Interfaces:
IWebSocketComm
The WebSocket Client pure socket implementation. This implementation is based on RFC 6455 "The WebSocket Protocol", also supporting the older "draft-ietf-hybi-thewebsocketprotocol-00" also called "Hixie 75/76" versions.
The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the origin-based security model commonly used by web browsers. The protocol consists of an opening handshake followed by basic message framing, layered over TCP. The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g., using XMLHttpRequest or <iframe>s and long polling).
To be implemented (fragmentation compliance with RFC 6455).
- Author:
- Christopher Mindus
Field Summary
Fields inherited from class com.iizix.nio.WebSocketCommNIO
requestURI
Constructor Summary
ConstructorDescriptionWebSocketComm
(WebSocketCommProps properties, Worker worker, WebSocketCommListener listener, SSLEngine engine) Creates a new WebSocket Client Communication channel as UNINITIALIZED.WebSocketComm
(WebSocketCommProps properties, Worker worker, SocketChannel channel, WebSocketCommListener listener, WebSocketAcceptor acceptor) Creates a new WebSocket Client Communication channel from an accepted socket connection and sets it to as CHECKING_CONNECT_REQUEST, before the negotiation is completed and then becomes CONNECTED.Method Summary
Methods inherited from class com.iizix.nio.WebSocketCommNIO
areBinaryDataFramesSupported, close, close, close, getAttachment, getDomain, getPort, getRemoteAddr, getRemoteHost, getSocketAddress, getState, getSubProtocol, isClosed, isClosing, isCompressionSupported, isConnected, isConnecting, isSecure, open, open, send, send, sendHeartBeat, serverInitializeComm, setAttachment, setSubProtocol
Field Details
properties
The WebSocket (and Socket) properties.
Constructor Details
WebSocketComm
public WebSocketComm(WebSocketCommProps properties, Worker worker, WebSocketCommListener listener, SSLEngine engine) throws IOException Creates a new WebSocket Client Communication channel as UNINITIALIZED.- Parameters:
properties
- The WebSocket properties.worker
- The worker thread for socket processing.listener
- The listener for WebSocket events.engine
- The SSL engine or null for plain connection.- Throws:
IOException
- For SSL errors.
WebSocketComm
public WebSocketComm(WebSocketCommProps properties, Worker worker, SocketChannel channel, WebSocketCommListener listener, WebSocketAcceptor acceptor) throws IOException Creates a new WebSocket Client Communication channel from an accepted socket connection and sets it to as CHECKING_CONNECT_REQUEST, before the negotiation is completed and then becomes CONNECTED.- Parameters:
properties
- The WebSocket properties.worker
- The worker thread for socket processing.channel
- The SocketChannel instance that has been accepted.listener
- The listener for WebSocket (server) events.acceptor
- The URI acceptor for WebSocket requests.- Throws:
IOException
- For I/O exceptions.