Skip to content

This is a simple simulation between 2 instruments. The instruments here are 2 node.js applications, where one is client and other is a server. The communication between both is full duplex socket communication

varad11/node-socket-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-socket-sim

This is a simple simulation between 2 instruments. The instruments here are 2 node.js applications, where one is client and other is a server. The communication between both is full duplex socket communication.

Scope

The project has 2 Node.js applications.

  1. instrument: A simulator of ICU monitoring system that returns oxygen saturation and body temperature of the patient. It runs on port 9889
  2. driver: Driver communicates with instrument through full duplex socket communication using commands to get data at that particular point in time.

An artificaial delay in instrument app is added to demonstrate delay in receiving data from instrument to the driver.
No 3rd party libraries used in development, everything done with in built modules.
Basic validations and guards added with exception handling.
Total of 4-5 hours was spent from start to end.

Execution

  1. Run instrument code with:
npm run instrument
  1. Run driver code with:
npm run driver

Troubleshooting

  1. If port 9889 is already in use, please change the port in the "scripts" section of package.json
  2. If driver shows "ECONNREFUSED" error then please check if instrument is running, and then restart driver.

Driver App Commands

  1. To get the oxygen saturation run the following command:
get oxygen
  1. To get the temperature run the following command:
get temperature
  1. To stop the driver app run the following command:
exit

Next phase tasks

  1. Use winston logger to do more efficient logging.
  2. Enable multi driver connections to instrument when needed.

About

This is a simple simulation between 2 instruments. The instruments here are 2 node.js applications, where one is client and other is a server. The communication between both is full duplex socket communication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published