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.
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.
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.
|Not supported||Core feature|
|Moderate to large for embedded systems||Minimal 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.