Its useful to keep the server configuration isolated from the application. Here is a trivial way to share the Gos WebSocket Config between the server and the client.
By default the config is shared, you can turn it off if you don't need in app/config/config.yml
gos_web_socket:
shared_config: false
<script type="text/javascript">
var _WS_URI = "ws://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}";
</script>
Now you will have access to a variable "_WS_URI" which you can connect with:
var myWs = WS.connect(_WS_URI);
Alternatively, if you don't like polluting your global scope, you can render it directly into your javascript file by processing it via a controller.
In service YAML :
%gos_web_socket.server.host% #host
%gos_web_socket.server.port% #port
In php :
//Host
$container->getParameter('gos_web_socket.server.host');
//Port
$container->getParameter('gos_web_socket.server.port');