Package com.iizix.comm
Class WebSocketServerComm
- java.lang.Object
- com.iizix.comm.WebSocketServerComm
public class WebSocketServerComm extends java.lang.Object
This class handles a Server Socket NIO implementation into a single-threaded Worker that accepts Socket connections in a non-blocking mode. When a socket connection is establishes to this server socket, it is assumed to have a HTTP header that matches the WebSocket protocol. All other HTTP requests are rejected.- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebSocketServerComm.State
The state of the connection.
Constructor Summary
Constructors Constructor Description WebSocketServerComm(WebSocketServerCommProps properties, Worker worker, TransactionCommListener listener, WebSocketAcceptor acceptor)
Constructs the WebSocket Server communication engine for the worker in question.WebSocketServerComm(WebSocketServerCommProps properties, Worker worker, WebSocketCommListener listener, WebSocketAcceptor acceptor)
Constructs the WebSocket Server communication engine for the worker in question.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
close()
Closes this server socket.WebSocketServerComm.State
getState()
Gets the state of the server socket.void
open()
Opens the server socket with an unused port within the specified range.
Constructor Detail
WebSocketServerComm
public WebSocketServerComm(WebSocketServerCommProps properties, Worker worker, TransactionCommListener listener, WebSocketAcceptor acceptor)
Constructs the WebSocket Server communication engine for the worker in question.
WebSocketServerComm
public WebSocketServerComm(WebSocketServerCommProps properties, Worker worker, WebSocketCommListener listener, WebSocketAcceptor acceptor)
Constructs the WebSocket Server communication engine for the worker in question.
Method Detail
open
public void open() throws WebSocketException
Opens the server socket with an unused port within the specified range.- Throws:
WebSocketException
- If the ServerSocket is already open, or if no socket was found available.
getState
public WebSocketServerComm.State getState()
Gets the state of the server socket.
close
public boolean close()
Closes this server socket.- Returns:
- true for successful close, false otherwise.