Counter Counter is an instant global click counter. When you click the button, updated count value is updated on all connected clients.
2952
<h:form id="form">
    <h:outputText id="out" value="#{globalCounterView.count}" styleClass="ui-widget display" />

    <p:commandButton value="Click" actionListener="#{globalCounterView.increment}" />
</h:form>

<p:socket onMessage="handleMessage" channel="/counter" />

<script type="text/javascript">
    function handleMessage(data) {
        $('.display').html(data);
    }
</script>

                    
PrimeTek, Copyright © 2015
All rights reserved.
Running PrimeFaces-6.0.16 on Mojarra-2.2.8.