- 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 theWebSocket
is properly rendered.- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
Socket
-
-
Constructor Summary
Constructors Constructor Description SocketFacesListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isListenerForSource(Object source)
Only listens onUIViewRoot
.void
processEvent(SystemEvent event)
If the socket has just switched theconnected
attribute, then render either theopen()
script or theclose()
script.
-
-
-
Method Detail
-
isListenerForSource
public boolean isListenerForSource(Object source)
Only listens onUIViewRoot
.- Specified by:
isListenerForSource
in interfaceSystemEventListener
-
processEvent
public void processEvent(SystemEvent event)
If the socket has just switched theconnected
attribute, then render either theopen()
script or theclose()
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 withtarget="body"
. Those scripts will in turn hitSocketEndpoint
.- Specified by:
processEvent
in interfaceSystemEventListener
-
-