Package io.openems.backend.edgewebsocket
Class WebsocketServer
java.lang.Object
io.openems.common.websocket.AbstractWebsocket<T>
io.openems.common.websocket.AbstractWebsocketServer<WsData>
io.openems.backend.edgewebsocket.WebsocketServer
-
Nested Class Summary
Nested classes/interfaces inherited from class io.openems.common.websocket.AbstractWebsocketServer
AbstractWebsocketServer.DebugMode
-
Constructor Summary
ConstructorsConstructorDescriptionWebsocketServer
(EdgeWebsocketImpl parent, String name, int port, int poolSize, AbstractWebsocketServer.DebugMode debugMode) -
Method Summary
Modifier and TypeMethodDescriptionprotected WsData
Creates an empty WsData object that is attached to the WebSocket as early as possible.protected OnClose
Callback for websocket OnClose event.protected OnError
Callback for websocket error.Callback for JSON-RPC notification.protected OnOpen
Callback for websocket OnOpen event.protected OnRequest
Callback for JSON-RPC request.protected JsonrpcMessage
handleNonJsonrpcMessage
(org.java_websocket.WebSocket ws, String stringMessage, OpenemsError.OpenemsNamedException lastException) Handle Non-JSON-RPC messages.boolean
Is the given Edge online?.protected void
Log a error message.protected void
Log a info message.protected void
Log a warn message.Methods inherited from class io.openems.common.websocket.AbstractWebsocketServer
broadcastMessage, execute, getConnections, getOnInternalError, getPort, sendMessage, start, stop
Methods inherited from class io.openems.common.websocket.AbstractWebsocket
getName, handleInternalErrorAsync, handleInternalErrorSync
-
Constructor Details
-
WebsocketServer
public WebsocketServer(EdgeWebsocketImpl parent, String name, int port, int poolSize, AbstractWebsocketServer.DebugMode debugMode)
-
-
Method Details
-
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
-
isOnline
Is the given Edge online?.- Parameters:
edgeId
- the Edge-ID- Returns:
- true if it is online.
-
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
-
handleNonJsonrpcMessage
protected JsonrpcMessage handleNonJsonrpcMessage(org.java_websocket.WebSocket ws, String stringMessage, OpenemsError.OpenemsNamedException lastException) throws OpenemsError.OpenemsNamedException Description copied from class:AbstractWebsocketServer
Handle Non-JSON-RPC messages.- Overrides:
handleNonJsonrpcMessage
in classAbstractWebsocketServer<WsData>
- Parameters:
ws
- theWebSocket
stringMessage
- the messagelastException
- the parse error- Returns:
- message converted to
JsonrpcMessage
; or null - Throws:
OpenemsError.OpenemsNamedException
- if conversion is not possible
-
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
-