E
E
evgenin2021-11-29 17:08:17
Socket.io
evgenin, 2021-11-29 17:08:17

How to run laravel-echo && socket.io?

I can’t connect to laravel-echo, I don’t see the connection in the console, so I can’t send a message, respectively. What are the options?

The message is sent via redis,

L A R A V E L  E C H O  S E R V E R

version 1.6.2

⚠ Starting server in DEV mode...

✔  Running at localhost on port 6001
✔  Channels are ready.
✔  Listening for http events...
✔  Listening for redis events...

Server ready!

Channel: database_translation
Event: TranslationEvent


On the client:
const echo = new Echo({
            host: 'http://mysite.ru:6001/',
            broadcaster: 'socket.io',
            client: socketio,
        });


       let i = echo.join(`database_translation`)
            .listen('TranslationEvent', (e) => {
                console.log('message from server',e)
                this.setState({
                    result: "changed"
                })
            });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evgenin, 2021-11-30
@evgenin

There was a conflict in the client version, downgraded the version and works for me on "socket.io-client": "^2.3.0"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question