WebSocketBundle
WebSocketBundle copied to clipboard
Uncaught ReferenceError: GosSocket is not defined
Following javascript client instructions here: https://github.com/GeniusesOfSymfony/WebSocketBundle/blob/3.x/docs/javascript-client.md
I got this error on my firefox Uncaught ReferenceError: GosSocket is not defined
This the final html I have (simplified at maximum) is this:
@mbabker I am also facing the same issue. I am using this plugin first time and got stuck due to this issue. cc: @AbrahamCovelo
This is what I have in my layout.html.twig
file:
<script src="{{ asset('bundles/goswebsocket/js/vendor/autobahn.min.js') }}"></script>
<script src="{{ asset('bundles/goswebsocket/js/websocket.min.js') }}"></script>
<script>
console.log(GosSocket); //Uncaught ReferenceError: GosSocket is not defined
</script>
Both js files are loaded successfully.
Change GosSocket to WS and it will work. Using WS is deprecated but it still functions, the documentation must be out of date with the most recent commit.
<script> var websocket = WS.connect('ws://127.0.0.1:8080'); </script>