Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
EE Times-Asia > Embedded

Embedded Web app server development (Part 2)

Posted: 28 Mar 2014 ?? ?Print Version ?Bookmark and Share

Keywords:Web application? LAN? TCP/IP? Embedded systems? ruggedized PC?

In Part 1 of this series, we explained that embedded Web Applications employ the same HTTP communications mechanism as your bank account or the latest game on your smartphone. And why not? The HTTP protocol is simplicity itself, consisting of only nine operations to transport requests and responses.

Given this simplicity, it is not surprising that developers frequently underestimate the amount of time required to produce the code used to respond to those operations. Creating only a basic web server takes months of additional coding and produces a suboptimal solution precisely because the HTTP protocol offers nothing more than those simple operations. It's for this reason that developers need to turn to web application servers.

Part 1 discussed how the combination of a application servers, script pages, and a synchronous JavaScript technologies combine to provide an optimal approach to address these challenges. The embedded web application developer is free to focus on their application-specific code.

This second part lifts the hood on how web application servers are set up and explains how to implement this optimal solution, providing links to a downloadable tutorial so you get a chance to play.

Application servers
Embedded web applications require the remote browser to be able to 'talk' to the system or device under control. A web server provides no such capability, so everything between the simple processing of HTTP and the application code itself becomes overhead to be developed as a part of the system. This is an unwelcome diversion from the cool application-specific code that makes the device do what it needs to do: control hydraulics on tanks, position satellite dishes, monitor incubator temperatures, or control production plant, lighting, heating, nightclub lasers, and so on.

Application servers provide that missing link, delivering configurable functionality that makes the connection between the simple HTTP operations and the complex matters the application needs to deal with. This low-level generic work is already done, and coding can focus on adapting the requests and responses to your specific technology.

Figure 1: An Application Server includes the basic functionality of a web server to process HTTP operations, and complements it with proven, efficient mechanisms to interface to the application. A development framework and libraries make the developer experience as pain free as possible. This example shows a possible application in a road tunnel lighting system, varying light intensity to match outside weather conditions.

Figure 1 shows how this is achieved. The application server is a compiled C code application, and provides the functions that make life so much easier by supplementing basic HTTP handling.

Several of these functions are there to handle scripting languages. To understand the benefit of the application server as a whole, it is therefore essential to know why there is such emphasis on scripting languages such as Lua. If this neat technique can handle the C and C++ we know and love, then why bother developers with a new language? To answer that, let us consider the development cycle for an embedded web application.

Lua delivers the user experience
The necessary work can be broken down into the following categories:
???Managing data
???Parsing requests
???Assembling responses

If C is used for embedded application development, even its level of strict typing becomes a disadvantage because there is so much conversion from text to other types implicit in the whole mechanism. Lua's flexible approach to data types addresses that.

1???2???3???4???5?Next Page?Last Page

Article Comments - Embedded Web app server development ...
*? You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.

Back to Top