Class SocketFacesListener

java.lang.Object
org.omnifaces.cdi.push.SocketFacesListener
All Implemented Interfaces:
FacesListener, SystemEventListener, EventListener

public class SocketFacesListener extends Object implements SystemEventListener

This Faces listener for UIViewRoot ensures that the necessary JavaScript code to open or close the WebSocket is properly rendered.

Since:
2.3
Author:
Bauke Scholtz
See Also:
  • Constructor Details

    • SocketFacesListener

      public SocketFacesListener()
  • Method Details

    • isListenerForSource

      public boolean isListenerForSource(Object source)
      Only listens on UIViewRoot.
      Specified by:
      isListenerForSource in interface SystemEventListener
    • processEvent

      public void processEvent(SystemEvent event)
      If the socket has just switched the connected attribute, then render either the open() script or the close() script. During an ajax request with partial rendering, it's added as <eval> by partial response writer, else it's just added as a script component with target="body". Those scripts will in turn hit SocketEndpoint.
      Specified by:
      processEvent in interface SystemEventListener