Initiate data transfers from Server => Client?

172
January 20, 2018, at 05:15 AM

i want to build a server app in node/express which receives requests from one client and sends information to another client, maybe somehow similar to this:

var express = require('express'); 
 
var app = express(); 
 
var IP_client1 = "10.1.2.3"; 
var IP_client2 = "10.1.2.4"; 
 
//get information from client1 
app.get('/client1',function(req,res){ 
  res.send('OK, will send it to client2"); 
//==>  How to send to client2 from here? 
}); 
 
//get information from client2 
app.get('/client2',function(req,res){ 
  res.send('OK, will send it to client1"); 
//==>  How to send to client1 from here?   
}); 
 
//==> How to send data to client1 or/and client2 from here? 
 
app.listen(3000);

I know how to handle requests from clients to the server, but how could i simply set up a transfer of data from the server to another arbitrary client? I went through a lot of tutorials, but no one covers this!

READ ALSO
How to use information from 4sq node module lat long into geocoder module

How to use information from 4sq node module lat long into geocoder module

How do I use the information that I receive from foursq node module (lat long) and use it into geocoder node module using promisesI am trying to do a reverse search with lat long

171
NodeJS measure an execution time that takes at least 10 microseconds

NodeJS measure an execution time that takes at least 10 microseconds

In my computer the below code takes 60-70 microseconds

185
Can't connect to Node server on Amazon EC2

Can't connect to Node server on Amazon EC2

Here's the appjs, the code is too long so that's why I'm showing this code only, there's no problem in other code I assume this is a network problem

188
MongoDB aggregate $in array

MongoDB aggregate $in array

In MongoDB I can do this:

334