Class WebsocketClient
java.lang.Object
io.openems.common.websocket.AbstractWebsocket<WsData>
io.openems.common.websocket.AbstractWebsocketClient<WsData>
io.openems.edge.controller.api.backend.WebsocketClient
-
Field Summary
Fields inherited from class io.openems.common.websocket.AbstractWebsocketClient
DEFAULT_DRAFT, NO_HTTP_HEADERS, NO_PROXY, ws
-
Constructor Summary
ModifierConstructorDescriptionprotected
WebsocketClient
(ControllerApiBackendImpl parent, String name, URI serverUri, Map<String, String> httpHeaders, Proxy proxy) -
Method Summary
Modifier and TypeMethodDescriptionprotected WsData
Creates an empty WsData object that is attached to the WebSocket as early as possible.protected void
Execute aRunnable
.Callback for websocket OnClose event.Callback for websocket error.Callback for JSON-RPC notification.Callback for websocket OnOpen event.Callback for JSON-RPC request.boolean
protected void
Log a error message.protected void
Log a info message.protected void
Log a warn message.protected ScheduledFuture
<?> scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) Schedules a command using theScheduledExecutorService
.Methods inherited from class io.openems.common.websocket.AbstractWebsocketClient
getOnInternalError, sendMessage, sendMessageOrError, sendRequest, start, startBlocking, stop
Methods inherited from class io.openems.common.websocket.AbstractWebsocket
getName, handleInternalErrorAsync, handleInternalErrorSync
-
Constructor Details
-
WebsocketClient
-
-
Method Details
-
getOnOpen
Description copied from class:AbstractWebsocket
Callback for websocket OnOpen event.- Specified by:
getOnOpen
in classAbstractWebsocket<WsData>
- Returns:
- the
OnOpen
callback
-
getOnRequest
Description copied from class:AbstractWebsocket
Callback for JSON-RPC request.- Specified by:
getOnRequest
in classAbstractWebsocket<WsData>
- Returns:
- the
OnRequest
callback
-
getOnNotification
Description copied from class:AbstractWebsocket
Callback for JSON-RPC notification.- Specified by:
getOnNotification
in classAbstractWebsocket<WsData>
- Returns:
- the
OnNotification
callback
-
getOnError
Description copied from class:AbstractWebsocket
Callback for websocket error.- Specified by:
getOnError
in classAbstractWebsocket<WsData>
- Returns:
- the
OnError
callback
-
getOnClose
Description copied from class:AbstractWebsocket
Callback for websocket OnClose event.- Specified by:
getOnClose
in classAbstractWebsocket<WsData>
- Returns:
- the
OnClose
callback
-
createWsData
Description copied from class:AbstractWebsocket
Creates an empty WsData object that is attached to the WebSocket as early as possible.- Specified by:
createWsData
in classAbstractWebsocket<WsData>
- Returns:
- the typed
WsData
-
logInfo
Description copied from class:AbstractWebsocket
Log a info message.- Specified by:
logInfo
in classAbstractWebsocket<WsData>
- Parameters:
log
- a Logger instancemessage
- the message
-
logWarn
Description copied from class:AbstractWebsocket
Log a warn message.- Specified by:
logWarn
in classAbstractWebsocket<WsData>
- Parameters:
log
- a Logger instancemessage
- the message
-
logError
Description copied from class:AbstractWebsocket
Log a error message.- Specified by:
logError
in classAbstractWebsocket<WsData>
- Parameters:
log
- a Logger instancemessage
- the message
-
isConnected
public boolean isConnected() -
execute
Description copied from class:AbstractWebsocket
Execute aRunnable
.- Specified by:
execute
in classAbstractWebsocket<WsData>
- Parameters:
command
- theRunnable
-
scheduleWithFixedDelay
protected ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Schedules a command using theScheduledExecutorService
.- Parameters:
command
- aRunnable
initialDelay
- the initial delaydelay
- the delayunit
- theTimeUnit
- Returns:
- a
ScheduledFuture
, or null if Executor is shutting down
-