Create a JavaScript WebSocket path with JSF
16 January 2017
Here is how you can create a WebSockets base path for your JavaScript with JSF. This WebSocket base path points back to your deployed application's WAR address.
<script type="text/javascript"> var base = "#{request.scheme.endsWith("s") ? "wss" : "ws" }://#{request.serverName}:#{request.serverPort}#{request.contextPath}"; </script>
I hope this helps.
Read : Create a JavaScript WebSocket path with JSF