Package co.arago.hiro.client.websocket
Class ActionWebSocket.InternalActionListener
- java.lang.Object
-
- co.arago.hiro.client.websocket.ActionWebSocket.InternalActionListener
-
- All Implemented Interfaces:
SpecificWebSocketListener
- Enclosing class:
- ActionWebSocket
protected class ActionWebSocket.InternalActionListener extends java.lang.Object implements SpecificWebSocketListener
Listener class for Action WebSockets.
-
-
Field Summary
Fields Modifier and Type Field Description protected ActionWebSocketListeneractionWebSocketListener
-
Constructor Summary
Constructors Constructor Description InternalActionListener(ActionWebSocketListener listener)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonClose(java.net.http.WebSocket webSocket, int statusCode, java.lang.String reason)Called right before the websocket is about to close.voidonError(java.net.http.WebSocket webSocket, java.lang.Throwable t)Called when an Exception is detected.voidonMessage(java.net.http.WebSocket webSocket, HiroMessage message)Handle incoming action messages.voidonOpen(java.net.http.WebSocket webSocket)Called right after the websocket has been opened.
-
-
-
Field Detail
-
actionWebSocketListener
protected final ActionWebSocketListener actionWebSocketListener
-
-
Constructor Detail
-
InternalActionListener
public InternalActionListener(ActionWebSocketListener listener)
Constructor- Parameters:
listener- The listener which received messages.
-
-
Method Detail
-
onOpen
public void onOpen(java.net.http.WebSocket webSocket)
Description copied from interface:SpecificWebSocketListenerCalled right after the websocket has been opened. Does nothing on default.- Specified by:
onOpenin interfaceSpecificWebSocketListener- Parameters:
webSocket- Reference to the websocket.
-
onMessage
public void onMessage(java.net.http.WebSocket webSocket, HiroMessage message) throws HiroException, java.io.IOException, java.lang.InterruptedExceptionHandle incoming action messages.- Specified by:
onMessagein interfaceSpecificWebSocketListener- Parameters:
webSocket- Reference to the websocket.message- The incomingHiroMessage.- Throws:
HiroException- On protocol errorsjava.io.IOException- On IO or JSON parsing errors.java.lang.InterruptedException- When a sleep gets interrupted.
-
onClose
public void onClose(java.net.http.WebSocket webSocket, int statusCode, java.lang.String reason)Description copied from interface:SpecificWebSocketListenerCalled right before the websocket is about to close. Does nothing on default.- Specified by:
onClosein interfaceSpecificWebSocketListener- Parameters:
webSocket- Reference to the websocket.statusCode- Status code sent from the remote side.reason- Reason text sent from the remote side.
-
onError
public void onError(java.net.http.WebSocket webSocket, java.lang.Throwable t)Description copied from interface:SpecificWebSocketListenerCalled when an Exception is detected. Does nothing on default.- Specified by:
onErrorin interfaceSpecificWebSocketListener- Parameters:
webSocket- Reference to the websocket.t- The Throwable thrown.
-
-