Package co.arago.hiro.client.websocket
Class EventWebSocket.InternalEventListener
- java.lang.Object
-
- co.arago.hiro.client.websocket.EventWebSocket.InternalEventListener
-
- All Implemented Interfaces:
SpecificWebSocketListener
- Enclosing class:
- EventWebSocket
protected class EventWebSocket.InternalEventListener extends java.lang.Object implements SpecificWebSocketListener
Listener class for Event WebSockets.
-
-
Field Summary
Fields Modifier and Type Field Description protected EventWebSocketListenereventWebSocketListenerReference to the external listener
-
Constructor Summary
Constructors Constructor Description InternalEventListener(EventWebSocketListener 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)Receives close messages.voidonError(java.net.http.WebSocket webSocket, java.lang.Throwable t)Called when an Exception is detected.voidonMessage(java.net.http.WebSocket webSocket, HiroMessage message)Called with an incoming message.voidonOpen(java.net.http.WebSocket webSocket)Sets the filters, scopes and callsEventWebSocket.TokenRefreshHandler.start().
-
-
-
Field Detail
-
eventWebSocketListener
protected final EventWebSocketListener eventWebSocketListener
Reference to the external listener
-
-
Constructor Detail
-
InternalEventListener
public InternalEventListener(EventWebSocketListener listener)
Constructor- Parameters:
listener- The listener which received messages.
-
-
Method Detail
-
onOpen
public void onOpen(java.net.http.WebSocket webSocket) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionSets the filters, scopes and callsEventWebSocket.TokenRefreshHandler.start().- Specified by:
onOpenin interfaceSpecificWebSocketListener- Parameters:
webSocket- The webSocket using this HiroWebSocketListener.- Throws:
java.lang.InterruptedException- On interrupt on sending.java.io.IOException- On IO errors or when messages cannot be parsed to JSON strings.java.util.concurrent.ExecutionException- When sending fails generally.java.util.concurrent.TimeoutException- When sending of data took longer thanAuthenticatedWebSocketHandler.webSocketRequestTimeoutms.
-
onMessage
public void onMessage(java.net.http.WebSocket webSocket, HiroMessage message) throws java.lang.ExceptionDescription copied from interface:SpecificWebSocketListenerCalled with an incoming message.- Specified by:
onMessagein interfaceSpecificWebSocketListener- Parameters:
webSocket- Reference to the websocket.message- The incomingHiroMessage.- Throws:
java.lang.Exception- Any Exception
-
onClose
public void onClose(java.net.http.WebSocket webSocket, int statusCode, java.lang.String reason)Receives close messages.This will stop the
EventWebSocket.tokenRefreshHandler.- 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.
-
-