Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: GosSocket is not defined #467

Open
AbrahamCovelo opened this issue Aug 2, 2022 · 2 comments
Open

Uncaught ReferenceError: GosSocket is not defined #467

AbrahamCovelo opened this issue Aug 2, 2022 · 2 comments

Comments

@AbrahamCovelo
Copy link

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:

<title>Welcome!</title> <script src="/bundles/goswebsocket/js/vendor/autobahn.min.js"></script> <script src="/bundles/goswebsocket/js/websocket.min.js"></script> <script> var websocket = GosSocket.connect('ws://127.0.0.1:8080'); </script>
@faiyazalam
Copy link

faiyazalam commented Oct 25, 2022

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

@benrcole
Copy link

benrcole commented Nov 5, 2022

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants