world-server.js 698 B

123456789101112131415161718192021222324252627282930313233
  1. const ipc=require('../../../node-ipc');
  2. /***************************************\
  3. *
  4. * You should start both hello and world
  5. * then you will see them communicating.
  6. *
  7. * *************************************/
  8. ipc.config.id = 'world';
  9. ipc.config.retry= 1500;
  10. ipc.serve(
  11. function(){
  12. ipc.server.on(
  13. 'app.message',
  14. function(data,socket){
  15. ipc.server.emit(
  16. socket,
  17. 'app.message',
  18. {
  19. id : ipc.config.id,
  20. message : data.message+' world!'
  21. }
  22. );
  23. }
  24. );
  25. }
  26. );
  27. ipc.server.start();