1var socket = io.connect('http://localhost');
2socket.emit('my other event', { my: 'data' });
3//server side
4io.sockets.on('connection', function (socket) {
5 socket.on('my other event', function (data) {
6 console.log(data);
7 });
8});
9//sending data from the user via a socket.io
10socket.on("test", function (data) {
11 data.forEach(obj => {
12 console.log("Yer : " + obj.yer + ", Lat : " + obj.lat + ", Long : " + obj.lng);
13 })
14});
1<script src="/socket.io/socket.io.js"></script>
2<script>
3 const socket = io();
4</script>