Package co.arago.hiro.client.websocket
Class ActionWebSocket
- java.lang.Object
-
- co.arago.hiro.client.websocket.AuthenticatedWebSocketHandler
-
- co.arago.hiro.client.websocket.ActionWebSocket
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ActionWebSocket extends AuthenticatedWebSocketHandler
The handler for Action WebSocket.- See Also:
- API Documentation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classActionWebSocket.Builderstatic classActionWebSocket.Conf<T extends ActionWebSocket.Conf<T>>protected classActionWebSocket.InternalActionListenerListener class for Action WebSockets.static classActionWebSocket.ResultParamsThis creates a useful payload for theActionHandlerResult.-
Nested classes/interfaces inherited from class co.arago.hiro.client.websocket.AuthenticatedWebSocketHandler
AuthenticatedWebSocketHandler.InternalListener, AuthenticatedWebSocketHandler.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected intresultRetries-
Fields inherited from class co.arago.hiro.client.websocket.AuthenticatedWebSocketHandler
apiName, endpoint, fragment, headers, internalListener, maxRetries, name, protocol, query, reconnectOnFailedSend, status, tokenAPIHandler, webSocketRequestTimeout
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedActionWebSocket(ActionWebSocket.Conf<?> builder)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Clears the stores.static ActionWebSocket.Conf<?>newBuilder(TokenAPIHandler tokenAPIHandler, ActionWebSocketListener actionWebSocketListener)Get aActionWebSocket.BuilderforActionWebSocket.static ActionWebSocket.ResultParamsnewResultParams()Static creatorvoidsendActionResult(java.lang.String id, ActionWebSocket.ResultParams resultParams)Send anActionHandlerResultusing the provided id and a ResultParams structure.voidsendActionResult(java.lang.String id, java.lang.String result)Send anActionHandlerResultusing the provided id and result string.-
Methods inherited from class co.arago.hiro.client.websocket.AuthenticatedWebSocketHandler
backoff, closeWebSocket, createWebSocket, restartWebSocket, send, start
-
-
-
-
Constructor Detail
-
ActionWebSocket
protected ActionWebSocket(ActionWebSocket.Conf<?> builder)
Constructor- Parameters:
builder- The builder for this class.
-
-
Method Detail
-
newResultParams
public static ActionWebSocket.ResultParams newResultParams()
Static creator- Returns:
- A new
ActionWebSocket.ResultParamsstructure.
-
newBuilder
public static ActionWebSocket.Conf<?> newBuilder(TokenAPIHandler tokenAPIHandler, ActionWebSocketListener actionWebSocketListener)
Get aActionWebSocket.BuilderforActionWebSocket.- Parameters:
tokenAPIHandler- The API handler for this websocket.actionWebSocketListener- The listener for this websocket.- Returns:
- The
ActionWebSocket.BuilderforActionWebSocket.
-
sendActionResult
public void sendActionResult(java.lang.String id, ActionWebSocket.ResultParams resultParams) throws HiroException, java.io.IOException, java.lang.InterruptedExceptionSend anActionHandlerResultusing the provided id and a ResultParams structure.- Parameters:
id- The id of the action message conversation.resultParams- Standard result structure for the result.- Throws:
HiroException- On protocol errorsjava.io.IOException- On IO or JSON parsing errors.java.lang.InterruptedException- When a sleep gets interrupted.
-
sendActionResult
public void sendActionResult(java.lang.String id, java.lang.String result) throws HiroException, java.io.IOException, java.lang.InterruptedExceptionSend anActionHandlerResultusing the provided id and result string.- Parameters:
id- The id of the action message conversation.result- The result string for theActionHandlerResult.- Throws:
HiroException- On protocol errorsjava.io.IOException- On IO or JSON parsing errors.java.lang.InterruptedException- When a sleep gets interrupted.
-
close
public void close()
Clears the stores. This object cannot be used again thereafter.- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classAuthenticatedWebSocketHandler
-
-