title: Write After end error when post request happen
body: <pre><code>'use strict';
  var express = require('express');
  var app = express();
  var Stomp = require('stomp-client');
  var cors = require('cors');
  
  var destination = '/topic/chat.';
  var client = new Stomp('127.0.0.1', 61613, 'admin', 'password');
  
  var bodyParser = require('body-parser');
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({
      extended: true
  }));
  
  app.use(cors());
  
  app.post('/activemq', function(req, res) {
  
      var message = req.body.message;
      var con_id = req.body.conId;
      var send_destination = destination + "" + con_id
      var obj = new Object();
      obj.text = message;
      obj['corre-id'] = "";
      var jsonString = JSON.stringify(obj);
  
      client.connect(function(sessionId) {
          client.subscribe(send_destination, function(body, headers) {
              console.log(body);
          });
          client.publish(send_destination, jsonString);
      });
      client.disconnect()
      res.json('success')
  });
  
  app.listen(3000, function() {
      console.log('Server listening on port 3000');
  });
  </code></pre>
  
  <p>Write After end error when post request happen.can anyone please help me </p>
  
  <pre><code>events.js:85
        throw er; // Unhandled 'error' event
              ^
  Error: write after end
      at writeAfterEnd (_stream_writable.js:167:12)
      at Socket.Writable.write (_stream_writable.js:214:5)
      at Socket.write (net.js:634:40)
      at StompFrame.send (C:\Users\jpsamaranayake\Desktop\node\node_modu
      at StompClient.onConnect (C:\Users\jpsamaranayake\Desktop\node\nod
      at Socket.emit (events.js:129:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1001:10)
  </code></pre>