Package org.java_websocket
Class AbstractWebSocket
- java.lang.Object
-
- org.java_websocket.WebSocketAdapter
-
- org.java_websocket.AbstractWebSocket
-
- All Implemented Interfaces:
WebSocketListener
- Direct Known Subclasses:
WebSocketClient
,WebSocketServer
public abstract class AbstractWebSocket extends WebSocketAdapter
Base class for additional implementations for the server as well as the client
-
-
Constructor Summary
Constructors Constructor Description AbstractWebSocket()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getConnectionLostTimeout()
Get the interval checking for lost connections Default is 60 secondsprotected abstract Collection<WebSocket>
getConnections()
Getter to get all the currently available connectionsboolean
isReuseAddr()
Tests Tests if SO_REUSEADDR is enabled.boolean
isTcpNoDelay()
Tests if TCP_NODELAY is enabled.void
setConnectionLostTimeout(int connectionLostTimeout)
Setter for the interval checking for lost connections A value lower or equal 0 results in the check to be deactivatedvoid
setReuseAddr(boolean reuseAddr)
Setter for soReuseAddrvoid
setTcpNoDelay(boolean tcpNoDelay)
Setter for tcpNoDelayprotected void
startConnectionLostTimer()
Start the connection lost timerprotected void
stopConnectionLostTimer()
Stop the connection lost timer-
Methods inherited from class org.java_websocket.WebSocketAdapter
onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketMessageFragment, onWebsocketPing, onWebsocketPong
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.java_websocket.WebSocketListener
getLocalSocketAddress, getRemoteSocketAddress, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand
-
-
-
-
Method Detail
-
getConnectionLostTimeout
public int getConnectionLostTimeout()
Get the interval checking for lost connections Default is 60 seconds- Returns:
- the interval
- Since:
- 1.3.4
-
setConnectionLostTimeout
public void setConnectionLostTimeout(int connectionLostTimeout)
Setter for the interval checking for lost connections A value lower or equal 0 results in the check to be deactivated- Parameters:
connectionLostTimeout
- the interval in seconds- Since:
- 1.3.4
-
stopConnectionLostTimer
protected void stopConnectionLostTimer()
Stop the connection lost timer- Since:
- 1.3.4
-
startConnectionLostTimer
protected void startConnectionLostTimer()
Start the connection lost timer- Since:
- 1.3.4
-
getConnections
protected abstract Collection<WebSocket> getConnections()
Getter to get all the currently available connections- Returns:
- the currently available connections
- Since:
- 1.3.4
-
isTcpNoDelay
public boolean isTcpNoDelay()
Tests if TCP_NODELAY is enabled.- Returns:
- a boolean indicating whether or not TCP_NODELAY is enabled for new connections.
- Since:
- 1.3.3
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay)
Setter for tcpNoDelayEnable/disable TCP_NODELAY (disable/enable Nagle's algorithm) for new connections
- Parameters:
tcpNoDelay
- true to enable TCP_NODELAY, false to disable.- Since:
- 1.3.3
-
isReuseAddr
public boolean isReuseAddr()
Tests Tests if SO_REUSEADDR is enabled.- Returns:
- a boolean indicating whether or not SO_REUSEADDR is enabled.
- Since:
- 1.3.5
-
setReuseAddr
public void setReuseAddr(boolean reuseAddr)
Setter for soReuseAddrEnable/disable SO_REUSEADDR for the socket
- Parameters:
reuseAddr
- whether to enable or disable SO_REUSEADDR- Since:
- 1.3.5
-
-