Ajax:Poll

UI Components for JSF
Post Reply

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

08 Oct 2022, 00:29

Sounds like you are losing connections. And Poll is not ideal for a chat you should really look at WebSockets. I use OmniFaces Socket: https://showcase.omnifaces.org/push/socket
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

NOTiFY
Posts: 393
Joined: 25 May 2016, 22:57

09 Oct 2022, 14:37

I used 'OmniFaces" with something like:

Code: Select all

<o:socket channel="databaseChannel" onmessage="socketListener">
    <f:ajax event="onPush" render=":tabHomeView:formFoodsCosmeticsMedicines:panelGridFoodsCosmeticsMedicines"/>
</o:socket>

Code: Select all

@Named
@ApplicationScoped
public class PushBean {

   private final Logger logger = LoggerFactory.getLogger(this.getClass());

   @Inject
   @Push(channel = "databaseChannel")
   private PushContext databaseChannel;

   public PushBean() {
   }

   public void onPush(@Observes PushEvent pushEvent) {
         logger.info(">>>>> onPush pushEvent getMessage = {}", pushEvent.getMessage());
         logger.info(">>>>> onPush databaseChannel = {}", databaseChannel.toString());

         databaseChannel.send("onPush");
   }
}
PF 13.0.0--Jakarta. Jakarta Faces 4.0.1/Kotlin Multiplatform 1.9.10
Mojarra 4.0.2, OmniFaces 4.2
WildFly 29.0.1.Final 'preview' Jakarta EE 10.0.0
JDK 20.0.2, Kotlin 1.9.10, Gradle 8.3 Groovy DSL, MongoDB 7.0.0
IntelliJ IDEA 2023.2.1, macOS Ventura 13.5.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 55 guests