Native DataNet realtime pub/sub for openFrameworks. Connect an openFrameworks app to browsers, phones, Processing sketches, Python, Arduino, and other creative tools through DataNet channels.
- JSON publish and subscribe with
ofJson - Binary messaging and a DMX frame helper
- Background authentication and WebSocket networking
- Heartbeat, automatic reconnect, and subscription replay
- Structured gateway errors and authoritative presence
- All user callbacks delivered on the openFrameworks main thread
- No addon dependencies; networking uses openFrameworks' bundled libcurl
- openFrameworks 0.12.1
- macOS, Windows, and Linux
- C++17
The examples and macOS CI target the latest stable openFrameworks release. The networking code uses portable openFrameworks and libcurl APIs for Windows and Linux as well. Please open an issue if you need an older OF version.
Clone the addon into the addons directory of an openFrameworks installation:
cd /path/to/openFrameworks/addons
git clone https://github.com/datanet-art/ofxDataNet.gitUse the Project Generator to add ofxDataNet to an app. No other addons are required.
#include "ofxDataNet.h"
ofxDataNet datanet;
const std::string channel = "project.your-project-id.demo";
void ofApp::setup() {
ofxDataNetConfig config;
config.apiKey = "ak_your_project_key";
config.displayName = "DataNet's openFrameworks App";
datanet.setup(config);
datanet.onError([](const ofxDataNetError& error) {
ofLogError("DataNet") << error.code << ": " << error.message;
});
datanet.subscribe(channel, [](const ofJson& data, const ofxDataNetMessageMeta& meta) {
ofLogNotice() << meta.from << ": " << data.dump();
});
datanet.connect();
}
void ofApp::mousePressed(int x, int y, int button) {
datanet.publish(channel, {{"x", x}, {"y", y}});
}ofxDataNet listens to ofEvents().update, so callbacks arrive safely on the main thread without a manual pump call.
example-basic: minimal JSON publish/subscribe with mouse positionexample-binary: publish a 512-channel DMX frameexample-presence: display authoritative channel occupancy
Replace the placeholder API key and channel at the top of each example before running it.
datanet.connect();
datanet.disconnect();
datanet.isConnected();
datanet.publish(channel, json);
datanet.subscribe(channel, handler);
datanet.unsubscribe(channel);
datanet.publishBinary(channel, bytes, contentType, metadata);
datanet.subscribeBinary(channel, handler);
datanet.publishDmx(channel, values);
datanet.getPresence(channel, handler);The repository follows the ofxAddons naming and layout conventions: the addon is named ofxDataNet, source lives in src/, and buildable examples use the example-* prefix. Public GitHub repositories with an ofx prefix are discovered automatically by ofxAddons; after the repository is public, an optional category request can be filed with the ofxAddons maintainers.
- Build all examples against openFrameworks 0.12.1 on at least macOS; CI also checks Linux.
- Tag the merged commit, for example
v0.1.0, and create a GitHub release. - Confirm the public repository appears on ofxAddons.
DataNet is developed and supported by Studio Jordan Shaw.