Socket not connecting for client side in Laravel

Published

I could connect with the socket with the below code.
Laravel version ^7.29

It’s showing connected equal false.
socket Socket {connected: false, disconnected: true}

NOT WORKING CODE WITH 4.4.0

 <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.4.0/socket.io.js"></script>
<script>
    const socket_laravel = io('http://127.0.0.1:1234');
</script>

WORKING CODE WITH 2.1.0

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.js"></script>
<script>
    const socket_laravel = io('http://127.0.0.1:1234');
</script>

Source: Laravel

Published
Categorised as chat, laravel, socket.io, sockets Tagged , , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq