I am trying to create using nodes core only a message sent by one server to another server (not clients just server-to-server).
In fact the servers are both the same server message is sent between 2 apps that must not be linked together. one must receive a remote message from the other.
I am looking over all google things and node docs but can't make sense of a few parts of the code for sending.
The first server only should receive messages:
var net=require('net');
var server1=net.createServer(function(nets){
nets.addListener('message',function(data){
console.dir(data);
});
});
server1.listen(8000,'localhost');
The second server should only send messages:
var net=require('net');
var server2=net.createConnection(8000,'localhost',function(nets){
nets.on('connect',function(){
nets.write('message',{'a':1,'foo':'bar'});
});
});
I am having trouble understanding the docs though, I defiantly need to use net because the 2 apps must not be attached to each other so eventEmitter is a no-no