public class WebSocketServer extends WebSocket
See http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-03 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 |
---|
WebSocketServer(Socket socket,
boolean isSecure)
Establishes the WebSocket connection using an already connected
socket.
|
Modifier and Type | Method and Description |
---|---|
void |
performHandshake(String resource,
Map<String,String> headerFields,
List<String> subProtocols,
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 WebSocketServer(Socket socket, boolean isSecure) throws IOException
socket
- The established socket.isSecure
- If the connection is secure.IOException
- For failures.public void performHandshake(String resource, Map<String,String> headerFields, List<String> subProtocols, boolean doFailForUnsupportedSubProtocol) throws IOException
resource
- The URL resource.headerFields
- The header fields of the HTTP request message.subProtocols
- The list of sub-protocols requested, null for none.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.