DDSKit is an inter-process communication library built using FastDDS. DDSKit aims provide a simpler and easier-to-use API in Swift, including asynchronous operations using await and a request-reply model, while still remaining performant. DDSKit enables FastDDS's datasharing, intra-process, and zero-copy delivery methods for faster communication between threads or processes on the same machine.
This does actually run on Linux, even though the SPI says it won't. I haven't gotten around to making a docker container that has FastDDS installed, so it will fail to build on the SPI's Linux builds.
Some use cases for this library are:
- Robotics/Interfacing with ROS2
- Distributed systems
- High data rate communitcation
Platform | Support |
---|---|
Linux | Supported*1*2 |
MacOS | Supported*3*2 |
Other Apple OSs | Supported*3*2 |
Windows | Absolutely no clue, but it might work*2 |
The following code publishes a message on a topic
import DDSKit
let participant = DDSParticipant()
let publisher = participant.publish(to: "hello/world")
publisher.publish(message)
To recieve this message, the following code subscribers to the topic
import DDSKit
let participant = DDSParticipant()
let subscriber = participant.subscribe(to: "hello/world")
for await message in subscriber.messages {
print(message)
}
If you are on Linux, you need to install FastDDS as well. Apple platforms default to using a prebuilt version.
DDSKit is available as a Swift Package Manager package. To use it in a package, add the following dependency in your Package.swift
.package(
url: "https://github.com/literally-anything/DDSKit.git",
from: "tag"
),
Replace "tag" with any release number: tags.
To use the DDSKit
library, add
.product(name: "DDSKit", package: "DDSKit"),
to your target's dependencies.