Advertisement
Guest User

Untitled

a guest
Sep 28th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. process.on('uncaughtException', function(err) {
  2.     console.log(err);
  3. });
  4.  
  5. var forever = require('forever');
  6. var util = require('util');
  7.  
  8. var chatServer = new (forever.Monitor)('forever.test.two.js')
  9. var hubServer = new (forever.Monitor)('forever.test.one.js')
  10.  
  11. chatServer.on('start', function(process, data){
  12.     util.puts('Chat : Started');
  13. });
  14. hubServer.on('start', function(process, data){
  15.     util.puts('Hub  : Started');
  16. });
  17.  
  18. // If the Hub Server dies. we must restart the Chat Server
  19. hubServer.on('restart', function(code){
  20.     util.puts('Hub  : Restarted');
  21.     chatServer.restart();
  22. });
  23. chatServer.on('restart', function(){
  24.     util.puts('Chat : Restarted');
  25. });
  26.  
  27. // If the Chat Server dies, just start that again
  28. chatServer.on('stop', function(){
  29.     util.puts('Chat : Stopped');
  30. });
  31.  
  32. hubServer.start();
  33. chatServer.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement