import Socket from socket-io code example

Example 1: import socket io frontend

<script src="/socket.io/socket.io.js"></script><script>  const socket = io('http://localhost');</script>

Example 2: angular socket.io with token header

var socket = io("http://localhost", {
  extraHeaders: {
    Authorization: "Bearer authorization_token_here"
  }
});

Example 3: 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);
    })
});