Package org.exoplatform.social.websocket
Class SpaceWebNotificationWebSocketService
java.lang.Object
org.exoplatform.social.websocket.SpaceWebNotificationWebSocketService
- All Implemented Interfaces:
org.picocontainer.Startable
public class SpaceWebNotificationWebSocketService
extends Object
implements org.picocontainer.Startable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpaceWebNotificationWebSocketService(org.exoplatform.container.PortalContainer container, org.exoplatform.social.notification.service.SpaceWebNotificationService spaceWebNotificationService, org.exoplatform.ws.frameworks.cometd.ContinuationService continuationService, org.mortbay.cometd.continuation.EXoContinuationBayeux continuationBayeux, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.IdentityManager identityManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidreceiveMessage(String wsClientId, String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem) Called when a new message is received via WebSocket from frontendvoidsendMessage(String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem) Propagate an event from Backend to frontend through WebSocket Message whenSpaceWebNotificationItemis alteredvoidstart()voidstop()
-
Field Details
-
COMETD_CHANNEL
- See Also:
-
OUTBOUND_ITEM_KEY
Key of theSpaceWebNotificationIteminside the outbound WebSocket message (server to browser). It has to be stable whatever the runtime class of the item (aSpaceWebNotificationItembuilt by the server or aSpaceWebNotificationItemUpdatereceived from the browser), since frontend components read this key to refresh the unread badges. Not to be confused with the inbound key (browser to server, camel case) read bySpaceWebNotificationWebSocketServerListener.- See Also:
-
-
Constructor Details
-
SpaceWebNotificationWebSocketService
public SpaceWebNotificationWebSocketService(org.exoplatform.container.PortalContainer container, org.exoplatform.social.notification.service.SpaceWebNotificationService spaceWebNotificationService, org.exoplatform.ws.frameworks.cometd.ContinuationService continuationService, org.mortbay.cometd.continuation.EXoContinuationBayeux continuationBayeux, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.IdentityManager identityManager)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.picocontainer.Startable
-
sendMessage
public void sendMessage(String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem) Propagate an event from Backend to frontend through WebSocket Message whenSpaceWebNotificationItemis altered- Parameters:
eventName- event name that will allow Browser to distinguish which behavior to adopt in order to update UIspaceWebNotificationItem- The unread item object
-
receiveMessage
public void receiveMessage(String wsClientId, String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem) throws Exception Called when a new message is received via WebSocket from frontend- Parameters:
wsClientId- Websocket Message event nameeventName- Event NamespaceWebNotificationItem-SpaceWebNotificationItemsent via Websocket- Throws:
Exception- when an error occurred while changing notification state
-