Basically I would like to transfer data from my web application created through node.js where I have data stored in collections in mongodb, and I want to use this data as an influence to my drawing application in openframeworks. What is the best way possible to communicate this data between these applications? Thanks.
there are many ways to do that. which protocol to choose depends on your requirements. here are a few that came to my mind.
it is very common for time-critical applications, some packages might get lost, as it is UPD based. package size is limited (depends on your network, router, switches, …, OS). Check out the ofxOsc examples. It is relatively easy to implement it on the oF side. the nodejs counter part could be handled by the node-osc package.
not as fast, but in most cases fast enough. it is TCP based, hence no loss of packages. your node app could open a websocket server and the oF app could connect to it, there are oF addons for using websocket clients, not sure whats the most recent one.
instead of websocket you could also use mqtt, especially if you work on more complex systems with more clients, communicating via different channels. downside here: it requires a broker which handles connections.
hope that helps
+1 for OSC
I’ve connected node.js (well meteor.js) to oF using ofxOsc and node-osc and it’s very responsive.
The thing I like about using OSC is that it’s a commonly used protocol so it’s easy to debug issues using other apps. I especially like Protokol to aid debugging.
and MQTT would work well if the latency is acceptable.
Hey thanks for the suggestion! Looking into ofxOsc and not sure how to get the mongodb data into the oF app and use it. Since you’ve already connected the apps I want to know how exactly or if there are any tutorials to achieve the connection. Please and thank u
How can I access the specific data from the database in the oF app (to use as values that will affect the drawing)?
I had a Meteor.js app running on DigitalOcean. Then I had a Chrome browser open on a specific page used only for queuing data for OSC sending. Meteor bundles node.js and mongodb (plus a few other things) that make it easy to build real time web apps. My queuing page monitored for mongodb updates and sent OSC messages to the oF app over the local network using node-osc.