'how to get data from tcp server port and display in html

ı want to get data from tcp port and show data on clientside by Javascript or Angular. ı can list data in console but dont know how to list on client side.

const port = 4000;
const host = '0.0.0.0';
let buffered='';
const client = new Net.Socket();
client.connect({ port: port, host: host }), function() {
    console.log('TCP connection established with the server.');

    client.write('Hello, server.');
};
client.on('data', function(chunk) {
    console.log('rocket name :'+chunk.slice(1,11).toString(),'rocket altitude:'+chunk.slice(13,17).readFloatBE(0)
    ,'rocket speed:'+chunk.slice(17,21).readFloatBE(0)
    ,'Temprature :'+chunk.slice(29,33).readFloatBE(0));


    client.end();
});




client.on('end', function() {
    console.log('Requested an end to the TCP connection');
});




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source