Barracuda App Server WebSocket Libraries

The Barracuda Application Server provides three WebSocket libraries:

  • WebSocket client library for Lua
  • WebSocket server library for Lua
  • WebSocket server library for C/C++

The client and server WebSocket libraries designed for Lua are included in the high-level socket API. The C WebSocket server library is designed for applications pushing real-time data directly from C/C++ code.

All WebSocket libraries can be used in secure mode (SSL/TLS).

WebSocket is a technology that initially starts as HTTP(S) and is upgraded to a persistent connection, thus enabling bidirectional real-time communication between a client such as a browser and the server. As web applications become more sophisticated, WebSocket is becoming more and more popular since it enables a way of building responsive real-time web applications.

The WebSocket libraries are available for all supported platforms, including VxWorks, Azure RTOS, RTXC, QNX, INTEGRITY, ยต-velOSity, Embedded Linux, Windows CE, embOS, SMX, MQX, and FreeRTOS/LwIP.

See also: SharkSSL WebSocket Client and SharkSSL WebSocket Server.

WebSockets vs HTTP/AJAX/REST

The WebSocket protocol defined in RFC 6455 specifies how a standard HTTPS request/response pair can be upgraded to a secure and persistent full-duplex connection. HTML5 WebSocket-based applications enable real-time communication while placing less burden on the servers.

Message Pattern
Service Push
Not supportedCore feature
Moderate to large for embedded systemsMinimal overhead per WebSocket message

The fact that Websockets provide a bi-directional communication channel between the browser and server immediately opens up some very interesting opportunities for web-based device management applications. Because the connection is persistent, the embedded web server can now initiate communication with the browser. The embedded web server can send alerts, updates, notifications, etc. This adds a whole new dimension to the types of web-based device management applications that can be constructed.

In fact, the entire AJAX protocol can be built using Websockets technology. WebSockets enables us to multiplex data on the same connection; thus, we can easily implement an AJAX library on top of WebSockets and still use the same WebSockets connection for bi-directional real-time data transfer.

For a deeper understanding of how WebSockets can be used for device management, see our tutorial:
A Modern Approach to Embedding a Web Server in a Device.

Next: Additional Protocol Stacks