← Back

ofxDataNet

github.com/datanet-art/ofxDataNet · @datanet-art
OF 0.12 Web/Networking Utilities

Native DataNet realtime pub/sub SDK for openFrameworks

1 0 Last commit 3mo ago Created 3mo ago

Branches ahead of main

These branches have commits not yet on main — could be unmerged fixes or work in progress worth a look.

agent/update-actions 2 commits ahead · last commit 3mo ago

README

ofxDataNet



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.

Features



Compatibility



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.

Install



Clone the addon into the addons directory of an openFrameworks installation:

cd /path/to/openFrameworks/addons
git clone https://github.com/datanet-art/ofxDataNet.git


Use the Project Generator to add ofxDataNet to an app. No other addons are required.

Quick start



#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.

Examples



Replace the placeholder API key and channel at the top of each example before running it.

API overview



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);


ofxAddons



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.

Release checklist



1. Build all examples against openFrameworks 0.12.1 on at least macOS; CI also checks Linux. 2. Tag the merged commit, for example v0.1.0, and create a GitHub release. 3. Confirm the public repository appears on ofxAddons.

About



DataNet is developed and supported by Studio Jordan Shaw.

License



MIT

Get this addon

HTTPS
SSH