Created
          January 2, 2017 15:06 
        
      - 
      
- 
        Save ndelangen/7ee14d6206297638d3b3c845b0d36509 to your computer and use it in GitHub Desktop. 
    If you have 2 independent NodeJS processes running and want them to communicate, this can be done reliably using a npm package: node-ipc
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const ipc = require('node-ipc'); | |
| ipc.config.id = 'a-unique-process-name1'; | |
| ipc.config.retry = 1500; | |
| ipc.config.silent = true; | |
| ipc.serve(() => ipc.server.on('a-unique-message-name', message => { | |
| console.log(message); | |
| })); | |
| ipc.server.start(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const ipc = require('node-ipc'); | |
| ipc.config.id = 'a-unique-process-name2'; | |
| ipc.config.retry = 1500; | |
| ipc.config.silent = true; | |
| ipc.connectTo('a-unique-process-name1', () => { | |
| ipc.of['jest-observer'].on('connect', () => { | |
| ipc.of['jest-observer'].emit('a-unique-message-name', "The message we send"); | |
| }); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
You have a typo:
Both occurrences of
jest-observershould bea-unique-process-name1.