At the moment i am using prime push to send a refresh command to the client's jsf page and the jsf page will then reload itself and render the changes. It looks something like that:
Server:
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/event/" + eventId, "updateEntries");
Client:
<p:socket channel="/event/#{detailController.id}" onMessage="handlePush"/>
<script type="text/javascript">
function handlePush(msg) {
switch (msg) {
case "updateEntries":
updateEntries();
break;
}
}
</script>
<h:form>
<p:remoteCommand name="updateEntries" actionListener="#{detailController.reloadEntries()}" update="entries" />
</h:form>
However this works pretty well but i think if i have more clients this will become a performance issue because every client requests the hole data at the same time.
My idea was to encode the entity which changed/added and transfer the json via the push to the client and decode the json and add it to the datatable.
Is there any other way how to deal with a large number of clients which need instant updates?