title: How to flush data to client just after res.write() is written, before res.end(), in Express.js?
body: <p>I've created a client of Apache Kafka using Kafkajs, and I'm trying to read messages from a topic in Kafka. It's working fine if I console.log(message). But I want to send message to client everytime whenever a new message is produced/written in the topic, the consumer is listening to, from producers, while keeping the connection alive.</p>
  
  <pre><code> // function, which is being called whenever it's specified route is being requested
   async readMessage(req, res, next, consumer) {
      const resMessage = {};
  
      res.writeHead(200, {'Content-Type': 'text/plain'});
  
      await consumer.run({
          eachMessage: async ({ topic, partition, message }) =&gt; {  
              res.write(message.value.toString());
          },
      });
  
      // res.send(resMessage);
  }
  </code></pre>
  
  <p>But after I send data to the express.js server, res.write() doesn't send the data to the client (I'm using Postman as my Node.js client). How do I flush the data written in res.write(), before res.end() is invoked?</p>