JSF2.3&;o:socket或f:websocket-Nothing';推动';给客户
在@BalusC的帮助下,我让我的EJB方法在JBoss WildFly 12.0.0.Final(MacOS)上使用运行在EE8上的JSF 2.3触发一个事件:JSF2.3&;o:socket或f:websocket-Nothing';推动';给客户,jsf,wildfly,omnifaces,jsf-2.3,Jsf,Wildfly,Omnifaces,Jsf 2.3,在@BalusC的帮助下,我让我的EJB方法在JBoss WildFly 12.0.0.Final(MacOS)上使用运行在EE8上的JSF 2.3触发一个事件: beanManager.fireEvent("updateNotifications" ); POJO: @Inject @Push(channel = "testChannel") private PushContext pushContext; public void onPersist(@Observes String no
beanManager.fireEvent("updateNotifications" );
POJO:
@Inject
@Push(channel = "testChannel")
private PushContext pushContext;
public void onPersist(@Observes String notification) {
logger.info("***** onPersist notification = {}", notification);
pushContext.send("updateNotifications");
}
接收并打印消息
16:03:36682信息[com.notifywell.ejb.foodsomeeticsmedicinesejb]
(默认任务-3)>>>>>>insertFoodsCosmeticsMedicinesEJB beanManager=
NOTiFYwell.ear/NOTiFYwellJAR.jar/[bean count=39]的Weld BeanManager
16:03:36695信息[com.notifywell.push.PushBean](默认任务3)
*****onPersist通知=更新通知
我无法通过Push-Send与XHTML进行通信。我已经尝试了OmniFaces3.1和JBoss WildFly 12 JSF2.3,但没有重新呈现任何内容(这里没有显示XHTML代码)。使用OmniFaces 3.1时,我无法获取要显示的onmessage:
<h:form>
<o:socket channel="testChannel" onmessage="socketListener"/>
<h:outputScript>
function socketListener(message, channel, event) {
console.log(message);
}
</h:outputScript>
</h:form>
没有被执行。我和Wildfly 14的情况完全一样 为了解决这个问题,我必须:
(可能没有必要执行步骤3,但我这样做是因为我遇到了太多其他错误)您在浏览器中调试了网络流量吗?在tcp.port==8080&&http上使用Wireshark和过滤。我看到我的单元测试正在运行。显示HTTP GET和OK 200的响应。“这就好像没有执行
pushContext.send(notification)
。”调试…uhhh如果您在ide的容器中运行应用程序,您应该能够调试…如果您有一个I可以尝试复制。但我不会试图复制。但是f:websockets有效吗?这有区别吗?
pushContext.send(notification);