Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.post('/processMessage', function (req, res) {
  2.     load();
  3.     log.info("[PROCESSMESSAGE] Se recibe processMessage desde: " + req.connection.remoteAddress + " H: " + JSON.stringify(req.headers))
  4.  
  5.  
  6.     var data = '';
  7.     req.on('data', function (chunk) {
  8.         data += chunk.toString();
  9.     });
  10.  
  11.     req.on('end', function () {
  12.  
  13.         for(var i=0, len=chamancitos.length; i < len; i++){
  14.             if(chamancitos[i].active)
  15.                 reenviarMensaje(chamancitos[i].ip, chamancitos[i].port, chamancitos[i].pathProcessMessage, data, function(resp){
  16.                    
  17.                     if(resp){
  18.                         res.write(resp);
  19.                         res.end();
  20.                     }else{
  21.                         res.write("OK");
  22.                         res.end();
  23.                     }                
  24.                 });
  25.         }
  26.     });
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement