Package com.seeq.link.agent
Class DefaultSeeqWsConnection
java.lang.Object
com.seeq.link.sdk.BaseConnection
com.seeq.link.agent.DefaultSeeqWsConnection
- All Implemented Interfaces:
SeeqWsConnection
,com.seeq.link.sdk.interfaces.Connection
@WebSocket
public class DefaultSeeqWsConnection
extends com.seeq.link.sdk.BaseConnection
implements SeeqWsConnection
Handles a WebSocket-based connection to the Seeq Application Server.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.seeq.link.sdk.interfaces.Connection
com.seeq.link.sdk.interfaces.Connection.ConnectionState, com.seeq.link.sdk.interfaces.Connection.StateChangedEventArgs
Nested classes/interfaces inherited from interface com.seeq.link.agent.interfaces.SeeqWsConnection
SeeqWsConnection.MessageReceivedEventArgs
-
Field Summary
FieldsFields inherited from class com.seeq.link.sdk.BaseConnection
lastException
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSeeqWsConnection
(SeeqWsConnectionPool pool, int poolMemberIndex, String linkURL, LoginAuthManager loginAuthManager, CertificateHandler certHandler, boolean isRemoteAgent, String agentIdentification, ExecutorService incomingMessageThreadPool, ExecutorService outgoingMessageThreadPool) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
connect()
Handles the act of connecting to the Seeq Application Server.void
destroy()
protected void
Disconnect from Seeq Application Server and ensure socket has been closed.boolean
The connection String for the Seeq Application Server.com.seeq.link.sdk.utilities.Event<SeeqWsConnection.MessageReceivedEventArgs>
Event to handle the reception of messages from the Seeq Application Server.int
hashCode()
void
protected void
monitor()
void
onSocketClose
(int statusCode, String reason) void
onSocketError
(org.eclipse.jetty.websocket.api.Session session, Throwable cause) void
onSocketMessage
(byte[] buffer, int offset, int length) void
onSocketOpen
(org.eclipse.jetty.websocket.api.Session session) boolean
sendMessage
(byte[] message) Sends a set of bytes to the Seeq server.protected void
Methods inherited from class com.seeq.link.sdk.BaseConnection
disable, enable, getBackgroundThreads, getConnectionMessage, getLastException, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, handleConnectionMonitorException, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.seeq.link.sdk.interfaces.Connection
disable, enable, getConnectionMessage, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod
-
Field Details
-
INCOMING_MESSAGE_THREAD_POOL_SIZE
public static final int INCOMING_MESSAGE_THREAD_POOL_SIZE- See Also:
-
-
Constructor Details
-
DefaultSeeqWsConnection
public DefaultSeeqWsConnection(SeeqWsConnectionPool pool, int poolMemberIndex, String linkURL, LoginAuthManager loginAuthManager, CertificateHandler certHandler, boolean isRemoteAgent, String agentIdentification, ExecutorService incomingMessageThreadPool, ExecutorService outgoingMessageThreadPool)
-
-
Method Details
-
getMessageReceivedEvent
public com.seeq.link.sdk.utilities.Event<SeeqWsConnection.MessageReceivedEventArgs> getMessageReceivedEvent()Description copied from interface:SeeqWsConnection
Event to handle the reception of messages from the Seeq Application Server.- Specified by:
getMessageReceivedEvent
in interfaceSeeqWsConnection
- Returns:
- the agent message received event
-
initialize
public void initialize()- Specified by:
initialize
in interfacecom.seeq.link.sdk.interfaces.Connection
- Specified by:
initialize
in classcom.seeq.link.sdk.BaseConnection
-
destroy
public void destroy()- Specified by:
destroy
in interfacecom.seeq.link.sdk.interfaces.Connection
- Specified by:
destroy
in classcom.seeq.link.sdk.BaseConnection
-
sendMessage
public boolean sendMessage(byte[] message) Description copied from interface:SeeqWsConnection
Sends a set of bytes to the Seeq server.- Specified by:
sendMessage
in interfaceSeeqWsConnection
- Parameters:
message
- The set of bytes to be sent- Returns:
- True if message was sent successfully
-
connect
protected void connect()Handles the act of connecting to the Seeq Application Server.- Specified by:
connect
in classcom.seeq.link.sdk.BaseConnection
-
monitor
protected void monitor()- Specified by:
monitor
in classcom.seeq.link.sdk.BaseConnection
-
disconnect
protected void disconnect()Disconnect from Seeq Application Server and ensure socket has been closed.- Specified by:
disconnect
in classcom.seeq.link.sdk.BaseConnection
-
onSocketOpen
@OnWebSocketConnect public void onSocketOpen(org.eclipse.jetty.websocket.api.Session session) -
onSocketClose
-
onSocketMessage
@OnWebSocketMessage public void onSocketMessage(byte[] buffer, int offset, int length) -
onSocketError
@OnWebSocketError public void onSocketError(org.eclipse.jetty.websocket.api.Session session, Throwable cause) -
getConnectionId
The connection String for the Seeq Application Server. This is the same as the URL property.- Specified by:
getConnectionId
in classcom.seeq.link.sdk.BaseConnection
-
setState
protected void setState(com.seeq.link.sdk.interfaces.Connection.ConnectionState newState, String message) - Overrides:
setState
in classcom.seeq.link.sdk.BaseConnection
-
equals
-
hashCode
public int hashCode()
-