Controlling the Raspberry Pi with Android via the WebSocket protocol

Lead Image © Cameron Ferrelle, 123RF.com

Dancing Lessons

If you want to use an Android app to invite the Raspberry Pi for a dance, you should bring WebSockets to the ball, because the TCP-based protocol makes for smooth communication with the graceful nano-computer.

The various small computers with relatively powerful microprocessors now on the market are attractive to developers, engineers, and makers alike. The processors provide fast and easy access to hardware buses via I2C, 1-Wire, or SPI, allowing users to combine the worlds of software and electronics.

Connecting data to the real world – for example, by reading external sensors or controlling actuators – calls for simple and efficient communication between a client and server, as provided by the WebSocket protocol. Basically, this technology is used when you want to realize fast and powerful, bi-directional communication in real time between web applications and clients.

In this article, I present two sample projects involving the operation of a Raspberry Pi as a WebSocket server to which a WebSocket client sends asynchronous broadcast messages. The projects are realized by means of a C implementation of the popular WebSocket protocol. With the use of software libraries, you can establish a handy communications channel without the need for a comprehensive knowledge of networking.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content