pradip shinde
pradip shinde

Reputation: 586

Node: Connect angular 6 client to Node server

I have node TCP socket server that i implemented using net module as shown in below

const net = require("net");
const server = net.createServer();
server.on("connection", function (socket) {
    socket.setEncoding('utf8');
      socket.on("data", function (d) {
      }
}
socket.on("end", function () {
        clients.splice(clients.indexOf(socket), 1);
        console.log('end event on socket fired');
    });

and i want my angular 6 app as a client to this TCP server. So i explore on the internet i only get with socket.io. Basic scenario is i have two clients one is raspberry which communicate on TCP/IP to my server and one is angular app that communicate with server using http. Any idea how to achieve this?

Upvotes: 1

Views: 498

Answers (1)

Janith
Janith

Reputation: 2910

As of my knowledge plain TCP/UDP connections from the browser is currently deprecated because of security issues. I believe you may have to use WebSockets both on angular and node sides.

Upvotes: 1

Related Questions