You are reading a single comment by @akot and its replies. Click here to read the full conversation.
  • @Robin thanks for your response. Unfortunately I have no control over the API and like I said it keeps sending chunked data and never stops doing it. Based on your hint I rewrote my code using tls and plain HTTP like so:

    var socket = require('tls').connect(opts, function() {
      socket.write('GET /somemethod  HTTP/1.1\r\n' +
                 'host: someapi.com\r\n' +
                  '\r\n');
    });
    
    socket.on('data', function(chunk) {
      if (chunk== "someEvent") {
                socket.end();
            }
    });
    
About

Avatar for akot @akot started