Class WebSocketServiceImpl
- java.lang.Object
-
- co.mastermindcms.framework.services.WebSocketServiceImpl
-
- All Implemented Interfaces:
WebSocketService
@Service public class WebSocketServiceImpl extends java.lang.Object implements WebSocketService
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.messaging.simp.SimpMessagingTemplate
messagingTemplate
private org.springframework.messaging.simp.user.SimpUserRegistry
simpUserRegistry
-
Constructor Summary
Constructors Constructor Description WebSocketServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateActionId()
This method does generation for unique action idjava.util.List<java.lang.String>
getSubscribers(java.lang.String destination)
This method retrieves all subscribers based on destinationvoid
sendGlobalResponse(java.lang.String destination, org.springframework.messaging.simp.SimpMessageHeaderAccessor headerAccessor, java.util.Map<java.lang.String,java.lang.Object> result)
This method does server-push for all usersvoid
sendSharedResponse(java.lang.String destination, java.util.Map<java.lang.String,java.lang.Object> result)
This method does server-push for subscribers from destinationvoid
sendUserResponse(java.lang.String destination, java.lang.String sessionId, org.springframework.messaging.simp.SimpMessageHeaderAccessor headerAccessor, java.util.Map<java.lang.String,java.lang.Object> result)
This method does server-push for current user
-
-
-
Method Detail
-
generateActionId
public java.lang.String generateActionId()
Description copied from interface:WebSocketService
This method does generation for unique action id- Specified by:
generateActionId
in interfaceWebSocketService
- Returns:
- generated unique id for the response
-
sendSharedResponse
public void sendSharedResponse(java.lang.String destination, java.util.Map<java.lang.String,java.lang.Object> result)
Description copied from interface:WebSocketService
This method does server-push for subscribers from destination- Specified by:
sendSharedResponse
in interfaceWebSocketService
- Parameters:
destination
- endpoint for web-socket connectionresult
- payload object for response
-
sendGlobalResponse
public void sendGlobalResponse(java.lang.String destination, org.springframework.messaging.simp.SimpMessageHeaderAccessor headerAccessor, java.util.Map<java.lang.String,java.lang.Object> result)
Description copied from interface:WebSocketService
This method does server-push for all users- Specified by:
sendGlobalResponse
in interfaceWebSocketService
- Parameters:
destination
- endpoint for web-socket connectionheaderAccessor
- header for web-socket responseresult
- payload object for response
-
sendUserResponse
public void sendUserResponse(java.lang.String destination, java.lang.String sessionId, org.springframework.messaging.simp.SimpMessageHeaderAccessor headerAccessor, java.util.Map<java.lang.String,java.lang.Object> result)
Description copied from interface:WebSocketService
This method does server-push for current user- Specified by:
sendUserResponse
in interfaceWebSocketService
- Parameters:
destination
- endpoint for web-socket connectionsessionId
- session id for current connected userheaderAccessor
- header for web-socket responseresult
- payload object for response
-
getSubscribers
public java.util.List<java.lang.String> getSubscribers(java.lang.String destination)
Description copied from interface:WebSocketService
This method retrieves all subscribers based on destination- Specified by:
getSubscribers
in interfaceWebSocketService
- Parameters:
destination
- endpoint for web-socket connection- Returns:
- the list of all subscribers based on destination
-
-