Reputation: 11
I want to use node.js to read and parse raw data that is send over TCP coming from a server that is continuously sending updated data every second.
i tried websocket first, but my embedded server does not provide a websocket handshake.
var WebSocket = require('ws')
var ws = new WebSocket("ws://1.100.0.250:9396");
ws.on('open', function open() {
ws.send('{abc123}');
});
ws.on('message', function incoming(data) {
console.log(data);
});
Upvotes: 1
Views: 534
Reputation: 203554
Websockets are not plain TCP sockets. If your server uses the latter, use net.connect()
.
Upvotes: 1