Click here to Skip to main content
14,174,749 members
Click here to Skip to main content
Add your own
alternative version

Stats

4.8K views
Posted 17 May 2016
Licenced CPOL

Creating an application that communicates with your board using Web Sockets

, 17 May 2016
Rate this:
Please Sign up or sign in to vote.
This simple Node.js project uses the socket.io Node.js module to enable real-time communication between a client and an Intel® Galileo board or Intel® Edison board.

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

This simple Node.js* project uses the socket.io 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 https://github.com/gomobile/iotapp-template-websockets.

Requirements

Creating a project

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

  4. Under Internet of Things Embedded Application, 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.

Building and running your project

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

  2. Once your project finishes building, a build complete message is displayed. Click the Upload icon to upload the project to your board.
  3. Click the 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 192.168.1.0, enter http://192.168.1.0:3000. 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.

  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.

<

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Intel Corporation
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
Group type: Organisation

43 members


You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190524.3 | Last Updated 17 May 2016
Article Copyright 2016 by Intel Corporation
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid