The server application is a multi-protocol Node.js application, written in a single file for convenience and ease of illustration here. It has two major I/O functions:
- Speaking HTTP and the WebSocket overlay (for real-time sockets communication) to web clients
- Communicating NETCONF over SSH to JUNOS OS routers
The asynchronous I/O model of Node.js allows us to implement this quite efficiently within a single application. An event loop polls for I/O from the operating system and dispatches prescribed event handlers as required.
Steps 1 through 3 see us setup the beginning of a Node.js application, download the necessary library modules and reference the namespace of our application. Notice also that in step 2, we identify ...