Lukáš Fryč created RF-12096:
-------------------------------
Summary: Push: there is delay between repeated subscribtion
Key: RF-12096
URL:
https://issues.jboss.org/browse/RF-12096
Project: RichFaces
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: component-push/poll
Affects Versions: 4.2.0.Final
Reporter: Lukáš Fryč
When you have conditionally rendered {{a4j:push}} component and you disable it,
then it stops to receive push events.
Once you enable it, there is delay before it will start to receive events again.
Sample code for reproduction:
{code:xml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j">
<f:view>
<h:head>
</h:head>
<h:body>
<h:form>
<br /><br /><br /><br />
<!-- PUSH 1 -->
<a4j:commandButton value="Push 1!"
action="#{richBean.push}" />
<a4j:outputPanel id="pushPanel">
<a4j:push id="push" rendered="#{not pushDisabled}"
address="sampleAddress"
ondataavailable="$('*[id$=outputDate]').text(event.rf.data)"
onsubscribed="alert('subscribed')" />
</a4j:outputPanel>
<a4j:outputPanel id="pushDisablementPanel">
<h:selectBooleanCheckbox value="#{pushDisabled}">
<a4j:ajax render="pushPanel pushDisablementPanel" />
</h:selectBooleanCheckbox>
<h:outputText value="#{pushDisabled ? 'disabled' :
'enabled'}" />
</a4j:outputPanel>
<br />
<a4j:outputPanel id="outputDate">
#{richBean.date}
</a4j:outputPanel>
<br />
</h:form>
</h:body>
</f:view>
</html>
{code}
{code:java}
package demo;
import java.util.Date;
import javax.faces.bean.ManagedBean;
import org.richfaces.application.push.MessageException;
import org.richfaces.application.push.TopicKey;
import org.richfaces.application.push.TopicsContext;
@ManagedBean
public class RichBean {
public Date getDate() {
return new Date();
}
public void push() throws MessageException {
TopicKey topicKey = new TopicKey("sampleAddress");
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, new Date().toString());
System.out.println("push event");
}
}
{code}
Steps to reproduce:
1. open the sample page (the "subscribed" message appears)
2. click on Push! button (the date is changed)
3. check the checkbox
4. click on Push! button (the date is not changed anymore)
5. uncheck the checkbox (the "subscribed" message appears again)
6. click on Push!
EXPECTED: the date should be changed
ACTUAL: the date is not changed
If you will wait for some seconds, the Push! button will cause change of the date,
but in this delay, client can lose data updates (since "subscribed" event does
not show that the client is starting to receive data).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira