Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

socket.io client send data node js server

var socket = io.connect('http://localhost');
socket.emit('my other event', { my: 'data' });
//server side
io.sockets.on('connection', function (socket) {
  socket.on('my other event', function (data) {
    console.log(data);
  });
});
//sending data from the user via a socket.io
socket.on("test", function (data) {
    data.forEach(obj => {
        console.log("Yer : " + obj.yer + ", Lat : " + obj.lat + ", Long : " + obj.lng);
    })
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #client #send #data #node #js #server
ADD COMMENT
Topic
Name
8+9 =