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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    Key of the SpaceWebNotificationItem inside the outbound WebSocket message (server to browser).
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    void
    receiveMessage(String wsClientId, String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem)
    Called when a new message is received via WebSocket from frontend
    void
    sendMessage(String eventName, org.exoplatform.social.notification.model.SpaceWebNotificationItem spaceWebNotificationItem)
    Propagate an event from Backend to frontend through WebSocket Message when SpaceWebNotificationItem is altered
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COMETD_CHANNEL

      public static final String COMETD_CHANNEL
      See Also:
    • OUTBOUND_ITEM_KEY

      public static final String OUTBOUND_ITEM_KEY
      Key of the SpaceWebNotificationItem inside the outbound WebSocket message (server to browser). It has to be stable whatever the runtime class of the item (a SpaceWebNotificationItem built by the server or a SpaceWebNotificationItemUpdate received 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 by SpaceWebNotificationWebSocketServerListener.
      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:
      start in interface org.picocontainer.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.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 when SpaceWebNotificationItem is altered
      Parameters:
      eventName - event name that will allow Browser to distinguish which behavior to adopt in order to update UI
      spaceWebNotificationItem - 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 name
      eventName - Event Name
      spaceWebNotificationItem - SpaceWebNotificationItem sent via Websocket
      Throws:
      Exception - when an error occurred while changing notification state