NEP CLI
An npm package and command line tool for NEP+
Last updated
An npm package and command line tool for NEP+
Last updated
After installing > 18.0, you can install NEP CLI using the following command in Windows:
In Linux and macOS you may need to use sudo
Verify that NEP CLI is installed correctly using the following command:
To verify, navigate to Control Panel -> System and Security -> Windows Defender Firewall -> Allow an app or feature through Windows Defender Firewall. Ensure that Node.js JavaScript Runtime is listed as an allowed app or feature. If it is not listed, click on the "Allow another app" button and add Node.js (C:\Program Files\nodejs\nodejs.exe).
nep master
Start master for managing NEP+ topics
nep ip
Display current Wi-Fi and Ethernet IP addresses of the computer
Use the following command to connect NEP nodes within a local network. This is applicable when the nodes are on the same computer or connected via Wi-Fi or Ethernet.
This command will display the next output:
This command initiates a NEP master node on your local network. NEP nodes within your network can connect to this master node to communicate with each other.
This command displays the current Wi-Fi and Ethernet IP addresses of the computer where this command is run. It identifies the operating system and accordingly fetches the network interfaces.
For each identified Wi-Fi interface, it fetches and prints the IP address. It also fetches and prints the IP address of the Ethernet interface. An example is show bellow:
nep topics
Displays the list of NEP+ topics
This command displays the list of NEP+ topics. It connects to the NEP master node at the local IP address (127.0.0.1) and sends a request for the list of topics. The command waits for a response from the master node or a timeout, whichever comes first.
nep publish <topic> <message>
Publish a message to a NEP+ topic (only JSON messages are supported)
Let's imagine that the topic test/json
is already registered in NEP+ master, and it is required to send the message {'msg':'hello'}
to a node subscribed to this topic using the command line interface.
This is possible with the command nep publish <topic> <message>
as follow:
If the message to send:{'msg':'hello'}
is written as: {"msg":"hello"}
it will produce an error. Therefore, use ' '
and not " "
In these examples, change test/json
by the topic you would like to publish a message. To see the list of registered topics, use the nep topics
command .
nep show [topic] [index]
Displays messages published to a specified NEP+ topic in the default browser. The [index] parameter specifies the index of the message to display and must be a number between 0 and 49.
nep echo [topic]
Subscribe to a NEP+ topic and display raw string messages
This command is used to display messages send in a specific topic in the default browser . The topic and index are optional parameters.
If no parameters are provided, the user will be prompted to select one of the available topics.
The index is used to identify a specific server instance when multiple servers are running. It helps in routing the messages correctly to the intended server for display in the web browser.
It's important to assign a unique index value for each topic. Duplicate index values can lead to confusion and incorrect routing of messages.
Example:
This command subscribes to a NEP+ topic and displays raw string messages. The topic is an optional parameter. If no topic is provided, the user will be prompted to select one of the available topics.
Example:
hz [topic]
Monitor the publishing rate of a NEP+ topic
delay [topic]
Monitor the delay between messages of a NEP+ topic
bw [topic]
Monitor the bandwidth used by a NEP+ topic
These commands are used to monitor various aspects of a NEP+ topic. The topic is an optional parameter. If no topic is provided, the user will be prompted to select one of the available topics.
This command is used to monitor the publishing rate of a NEP+ topic. It displays the rate at which messages are being published to the specified topic.
Example:
This command is used to monitor the delay in message delivery for a NEP+ topic. It displays the time taken for messages to be delivered from the publisher to the subscriber for the specified topic.
Example:
This command is used to monitor the bandwidth usage of a NEP+ topic. It displays the amount of data being transmitted over the network for the specified topic.
Example:
record [topic]
Record messages from a NEP+ topic to a JSON bag file
nep play <bagfile> <topic>
Play messages from a bag file to a NEP+ topic
These commands are used to record and playback messages from a NEP+ topic.
This command is used to record messages from a specified NEP+ topic. If no topic is not provided, the user will be prompted to select one of the available topics. User can prompt a timeout (in miliseconds)
Example:
This command is used to playback messages from a recorded file. The bagfile must be a JSON file created by nep record command.