High Level Secure Socket & Websocket API

The high level secure socket and secure WebSocket API provides a Lua API to the lower level Barracuda Embedded Web Server's portable socket API. The socket API is portable across all platforms supported by the Barracuda Embedded Web Server.

The socket API is also integrated with SharkSSL (our SSL/TLS client and server stack), thus making it extremely easy to create secure socket applications.

Additional Protocol Stacks:

We provide a number of protocol stacks that are using the high level socket API. These protocol stacks are implemented in the Lua scripting language and are included as optional Barracuda App Server components.

* All of the above protocols utilize Cosockets!

Cosockets - Non Blocking Sockets Made Easy

Cosockets is our user-friendly, highly secure socket and WebSocket API that provides you with an easier way to design non-blocking, event driven socket applications in a structured and organized way. Design resource-efficient applications and manage task scheduling without blocking native threads or interrupting OS-scheduled processes, seamlessly integrating your applications with normal device operation.

Why use Cosockets?

Creating non-blocking event driven network applications has traditionally been a difficult task. Because network applications typically spend much of the time waiting for I/O events, socket APIs are usually utilizing callbacks or threads, but each of these have significant disadvantages. Callbacks can be difficult to design and analyse because the code is not running sequentially, which impacts readability and makes it difficult to create and manage the execution loop in a development environment. Especially for large, non-blocking asynchronous socket applications, this can create a real headache for your developers. Threads are easier to use, since they enable developers to write sequential code using the blocking socket API. However, threads have a much greater impact on computing resources, making them unsuitable for resource-constrained devices especially when multiple connections are required.

To solve this problem, we have created Cosockets, a socket and websocket API designed around Lua coroutines, providing you with an efficient and easy way to manage program execution flow and scheduling when developing socket applications for your devices. Coroutines are as resource-friendly as callbacks, and allow application execution loops to operate in a similar manner, all without sacrificing readability and without running into the typical callback hell associated with traditional non-blocking socket programming. This allows you to write code in a very readable and sequential way while freeing up resources on your device for other functions. Coroutines also allow you to separate your application scheduling entirely from the device OS, giving you the flexibility and portability you need to make your applications run the way you want them to on any OS.


By utilizing our Cosockets API, you will have a better, smoother experience developing, deploying, and managing network applications for your devices. The Lua scripting language greatly simplifies application design, and our Cosockets API makes writing advanced network applications in Lua a breeze. Since Lua is one of the fastest scripting languages, little overhead is incurred versus writing socket applications in C or C++.

Download the Barracuda App Server today to see how you can benefit from Cosockets.