Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Unable to connect with laravel-echo-server with latest socket.io-client #576

Open
kartiksprajapati opened this issue Jun 5, 2021 · 9 comments

Comments

@kartiksprajapati
Copy link

kartiksprajapati commented Jun 5, 2021

Describe the bug
Whenever I try to connect with laravel-echo-server with the latest socket.io-client and laravel-echo, it does not connect to the laravel-echo-server, however If I downgrade socket.io-client version to 2.3.0, it works like charm.

I don't know why it is failing

To Reproduce
Steps to reproduce the behavior:

  1. Install laravel-echo and socket.io-client on fresh vue project.
  2. Add this code to src/main.js
window.io = require('socket.io-client');

window.Echo = new Echo({
    broadcaster: "socket.io",
    host: "http://localhost:6001",
    transports: ["websocket"]
});

window.Echo.channel('user-channel')
    .listen('UserEvent', e => {
        console.log(e);
        alert(e.name);
    });

window.Echo = Echo;
  1. But, If I downgrade to v2.3.0, then it works, same version as of socket.io in laravel-echo-server/package.json

Expected behavior
It should connect to the laravel-echo-server but won't connect

Additional context
But, if the socket.io-client downgrade to v2.3.0 it works, not working with the latest version.

@mattvb91
Copy link

mattvb91 commented Jun 6, 2021

Just came across the same issue downgrading worked

@kartiksprajapati
Copy link
Author

And, downgraded version is also not safe

@mattvb91
Copy link

mattvb91 commented Jun 6, 2021

#572 might be a fix but I havent had the chance to check it yet, looks like this repo is abandoned

@kartiksprajapati
Copy link
Author

yaa... that's true I think so... I will try that package soon...

@nguyentranchung
Copy link

Because socket.io is using version 2

"socket.io": "^2.3.0",

the client must also use version 2

@bradleyking-dev
Copy link

When i downgraded socket.io-client to 2.3.0 it works

@dof-wmy
Copy link

dof-wmy commented Sep 7, 2021

Because socket.io is using version 2

"socket.io": "^2.3.0",

the client must also use version 2

https://socket.io/docs/v4/client-installation/index.html

image

@rrolla
Copy link

rrolla commented Oct 24, 2021

Here is discussion how to get it working for me works with socket.io-client v4 laravel/echo#290 (comment)

@rroblik
Copy link

rroblik commented Apr 6, 2022

Is this will be fixed or never ?

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

No branches or pull requests

7 participants