Class WsData
java.lang.Object
io.openems.common.websocket.WsData
io.openems.backend.uiwebsocket.impl.WsData
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the token or throws an error if no token was set.getToken()
Gets the Login-Token.Gets the authenticated User.Gets the authenticated User-ID.void
handleSubscribeChannelsRequest
(String edgeId, SubscribeChannelsRequest request) Applies a SubscribeChannelsRequest.void
handleSubscribeEdgesRequest
(Set<String> edgeIds) Applies a SubscribeEdgesRequest.boolean
isEdgeSubscribed
(String edgeId) Is the given Edge subscribed by this UI session?.void
logout()
Logout and invalidate Session.void
sendSubscribedChannels
(String edgeId, EdgeCache edgeCache) Sends the subscribed Channels to the UI session.void
void
toString()
Provides a specific toString method.void
Unsets the Login-Token.void
Unsets the User-Token.Methods inherited from class io.openems.common.websocket.WsData
dispose, getWebsocket, handleJsonrpcResponse, send, send, setWebsocket
-
Constructor Details
-
WsData
-
-
Method Details
-
logout
public void logout()Logout and invalidate Session. -
setUserId
-
unsetUserId
public void unsetUserId()Unsets the User-Token. -
getUserId
Gets the authenticated User-ID.- Returns:
- the User-ID or Optional.Empty if the User was not authenticated.
-
getUser
Gets the authenticated User.- Parameters:
metadata
- the Metadata service- Returns:
- the User or Optional.Empty if the User was not authenticated or it is not available from Metadata service
-
setToken
-
getToken
Gets the Login-Token.- Returns:
- the Login-Token
-
unsetToken
public void unsetToken()Unsets the Login-Token. -
assertToken
Gets the token or throws an error if no token was set.- Returns:
- the token
- Throws:
OpenemsError.OpenemsNamedException
- if no token has been set
-
toString
Description copied from class:WsData
Provides a specific toString method. -
handleSubscribeChannelsRequest
Applies a SubscribeChannelsRequest.- Parameters:
edgeId
- the Edge-IDrequest
- theSubscribeChannelsRequest
-
handleSubscribeEdgesRequest
Applies a SubscribeEdgesRequest.- Parameters:
edgeIds
- the edges to subscribe
-
sendSubscribedChannels
Sends the subscribed Channels to the UI session.- Parameters:
edgeId
- the Edge-IDedgeCache
- theEdgeCache
for the Edge-ID
-
isEdgeSubscribed
Is the given Edge subscribed by this UI session?.- Parameters:
edgeId
- the Edge-ID- Returns:
- true if subscribed
-