Browser Stats Data can be pushed from anywhere such as JSF backing beans, CDI Events, JMS and more. In this example a servlet filter keeps track of browser stats of visitors to this page and when a new user makes a request to view this page, stats data is pushed from filter and chart component to visualize the stats is updated real-time.
<h:form>
    <p:chart type="pie" widgetVar="browserChart" model="#{browserStatsView.pieModel}" style="width:400px;height:300px"  />

    <p:socket onMessage="handleMessage" channel="/browser" />
</h:form>

<script type="text/javascript">
    function handleMessage(data) {
        var series = [],
        chart = PF('browserChart').plot;

        for(var key in data) {
            series.push([key, data[key]]);
        }

        chart.series[0].data = series;
        chart.replot();
    }
</script>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.1.4 on Mojarra-2.2.10.