Creating an application that communicates with your board using Web Sockets

This simple Node.js* project uses the Node.js module to enable real-time communication between a client and an Intel® Galileo board or Intel® Edison board. You can use the client-side application provided with this project to view the number of users connected to the board, send text messages between connected users, and turn an LED on the board on ad off.

For sample code and design considerations, including in-depth technical information about this application, see


  • You have installed the Intel® XDK and connected it to your Intel® Galileo board or Intel® Edison board. For steps, see Getting started with the Intel® XDK.
  • Your board must be connected to the Internet on the same network as your computer. For steps, see the appropriate link below:

Creating a project

  1. Run the Intel XDK.
  2. In the top left, click the Projects tab.
  3. Click Start a New Project.

    Starting a new project

  4. Under Internet of Things Embedded Application, click Templates.

    Click Templates

  5. From the right, click Web Sockets. Click Continue.
  6. Type a name for the project in the Project Name field, then click Create. Your new project opens.

    Provide a project name

Building and running your project

  1. To install the required Node.js modules for this project, click the Build/Install icon Install/Build icon. If you are prompted to choose whether to upload or build your project, click Build.

    Choosing to upload or build the project
  2. Once your project finishes building, a build complete message is displayed. Click the Upload icon Upload icon to upload the project to your board.
  3. Click the Run icon Run icon to run your project.

Testing the Web Sockets Client Console

  1. In a web browser, type the IP address of your board, followed by a colon (:) and the port number to use to connect to your board, which in this example is 3000. For example, if the IP address of your board is, enter The Web Sockets Client Console application opens, with a list of users currently connected to the board displayed under Connected Users.

    Note: If you don't know your board's IP address, open a serial or SSH connection with your board and enter the command: ifconfig. The IP address is displayed, as shown below.

    Find your IP address.

  2. You can turn an onboard LED on your board on and off by clicking Toggle LED in your browser. Your actions are recorded under the Log heading. To send a message to other users, type a message in the field and click Send.

    Example of the Web Sockets client

For more complete information about compiler optimizations, see our Optimization Notice.