WebSocketBundle icon indicating copy to clipboard operation
WebSocketBundle copied to clipboard

Uncaught ReferenceError: GosSocket is not defined

Open AbrahamCovelo opened this issue 2 years ago • 2 comments

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:

Welcome!

AbrahamCovelo avatar Aug 02 '22 10:08 AbrahamCovelo

@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.

faiyazalam avatar Oct 25 '22 14:10 faiyazalam

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>

benrcole avatar Nov 05 '22 11:11 benrcole