libssrcspread C++/Lua/Perl/Python/Ruby Bindings for Spread

Software icon

libssrcspread provides C++, Lua, Perl, Python, and Ruby bindings for the Spread group communication system. Even though you can use the Spread C API directly in C++ code, error handling and data structure manipulation can be cumbersome. libssrcspread takes away some of that pain by providing automatic operation retries, automatic resizing of message and group buffers, exceptions for true errors, and safe connection management via the resource acquisition is initialization idiom.

libssrcspread works with Spread Toolkit versions 3.17.3, 4.x, and 5.0. For more information, read the overview.

A Simple Example

The main entry point to using the API is the Mailbox class, which is used to establish a connection with the Spread daemon, join/leave groups, and send/receive messages. There are a number of different ways to assemble and send messages. The following C++ code demonstrates a simple way of sending a string to a group:

using namespace ssrc::spread; const std::string data("Hello World!"); Mailbox mbox; Message msg; msg.write(data.c_str(), data.size() + 1); mbox.send(msg, "HelloGroup");

The same example using Python:

mbox = ssrc.spread.Mailbox() msg = ssrc.spread.Message() msg.write("Hello World") mbox.send(msg, "HelloGroup")

Even though libssrcspread simplifies using the Spread group communication system, it is still a rather low-level API. To do anything of consequence, you will want to serialize and deserialize data structures to and from message buffers. Also, you will want to use an event loop to receive messages. Wisp™ provides that functionality and should be of interest to anyone building services using group communication.

This product uses software developed by Spread Concepts LLC for use in the Spread toolkit. For more information about Spread, see http://www.spread.org/.