PhotoShare When you take a photo with PhotoCam component, the image is send to all connected clients instantly.
<h:form prependId="false">
    <p:photoCam id="photo" widgetVar="pc" listener="#{photoShareView.sendPhoto}"/>
    <p:commandButton id="button" type="button" value="Capture" onclick="PF('pc').capture()" icon="fa fa-camera"/>
    <p:outputPanel id="images" style="margin-top:10px"/>
</h:form>

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

<script type="text/javascript">
        function handleMessage(data) {
            $('#images').prepend('<img src="' + data + '">');
        }
</script>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.1.4 on Mojarra-2.2.10.