Skip to content

Socket

Overview

A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to.

Prerequisite:

socket example.zip

Donwload socket example.zip

This zip file should contain:

  1. Node_modules folder
  2. Automobile.json
  3. Change.html
  4. Change.js
  5. Index.html
  6. package-lock.json
  7. Server.js

Additionally, you need a dashboard for socket and its databases. Upload the dataset first into AIV, then upload the dashboard.

Steps

  1. Once the dashboard is successfully uploaded, open the command prompt and navigate to the folder containing the Server.js file. Image

  2. Run this command: node server.js.

  3. This command will start the node server. To verify, open a browser and enter localhost:5002 in the address bar. Image

  4. Once the screen is available, open a new tab and enter the URL localhost:5002/change, then hit Enter. Image

  5. To start the socket, click on the start button. You’ll notice the socket status changing to “Started”, and a Socket ID will be displayed. Image

  6. Go back to the previous tab, and you’ll observe data refreshing. This indicates that the socket is functioning.

  7. Navigate to AIV and open the socket dashboard you uploaded. You’ll see widget data updating frequently.