public class WebSocketClient extends WebSocket
See http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07 for more information.
The WebSocket protocol enables two-way communication between a user agent running untrusted code running 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 initial 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).
WebSocket.State
ACCEPT_GUID, clientToServerMask, CRLF, CS_FRAME_GUID, input, isSecure, isVerbose, output, protocolVersion, socket, ssubProtocol, state
Constructor and Description |
---|
WebSocketClient(Socket socket,
boolean isSecure,
String host,
int port,
String resource,
List<String> subProtocols)
Establishes the WebSocket connection using an already connected
socket.
|
WebSocketClient(Socket socket,
InputStream input,
OutputStream output,
boolean isSecure,
String host,
int port,
String resource,
List<String> subProtocols)
Establishes the WebSocket connection using an already connected
socket.
|
Modifier and Type | Method and Description |
---|---|
void |
performHandshake(boolean doFailForUnsupportedSubProtocol)
Performs the Web Socket handshake.
|
close, closeSocket, closeSocketHard, getBinaryMessage, getOldTextProtocol, getProtocolVersion, getServerSubProtocol, getState, getTextMessage, hasBinaryMessage, hasTextMessage, isVerbose, readMessage, sendBinaryData, sendBinaryData, sendText, setOldTextProtocol, setProtocolVersion, setVerbose
public WebSocketClient(Socket socket, boolean isSecure, String host, int port, String resource, List<String> subProtocols) throws IOException
socket
- The established socket.isSecure
- If the connection is secure.host
- The host used to establish the socket connection.port
- The port used to establish the socket connection.resource
- The URI.subProtocols
- The list of sub-protocols requested, null for none.IOException
- For failures.public WebSocketClient(Socket socket, InputStream input, OutputStream output, boolean isSecure, String host, int port, String resource, List<String> subProtocols) throws IOException
socket
- The established socket.input
- The input stream.output
- The output stream.isSecure
- If the connection is secure.host
- The host used to establish the socket connection.port
- The port used to establish the socket connection.resource
- The URI.subProtocols
- The list of sub-protocols requested, null for none.IOException
- For failures.public void performHandshake(boolean doFailForUnsupportedSubProtocol) throws IOException
doFailForUnsupportedSubProtocol
- Flag indicating a WebSocketException is thrown if the
server doesn't support request protocols (if any).IOException
- For failures.EOFException
- For unexpected closure of the socket.WebSocketException
- For exceptions relating to Web Sockets (protocol, etc).Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.