How to connect node server with vue socket

Published

I am using vue.js(Laravel) to connect with my chat node server, its connect socket but emit not work with function.

      var socket = io.connect('http://localhost:3000/api/message');

        socket.on('connect', function () {

           var mapdata = {chatId: this.chatIdd, userId: this.userIdd}

           socket.emit("joinChat", JSON.stringify(mapdata) ,function(confirmation){
               alert('Work');

                      console.log(confirmation);
              });

        }.bind(this));
           socket.on('msgReceive', function () {


        }.bind(this));

alert(‘Work’) Not showing. How can i resolve this?

Source: Laravel

Published
Categorised as laravel, node.js, socket.io, vue.js, websocket 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