I am building a Node app that talks to an Xbee over serial and reads/controls several sensors/relays that are also Xbee equipped. I would like to use Meteor for the user interface and data storage with the Node app simply sending sensor updates and controlling the relays when triggered by the Meteor app. What would be the proper way to communicate between the Node and Meteor app? I know I can use a Node DDP client to insert sensor readings to the Meteor app. The part I am having problems with is sending commands from Meteor to the Node app to control the relays. I simply need to send a command that will execute certain code on the Node app to switch the relays. Maybe this is a simple question, but I'm not sure of the best way to accomplish this. Thanks in advance for any input.
You could just use Mongo as your point of integration. Each XBee device could just be a mongo document.
{
address: 'xbeeaddress',
relay1: 'on'
}
Related
I'm about to create a React Native mobile application that can manipulate data to a remote MySQL database (cloud / not in mobile) without using PHP (back-end) at all. Is it possible or not?
it's not necessary you use a web service connecting to a database (but it is recommended).
In my case, I wrote a native module(Android https://facebook.github.io/react-native/docs/native-modules-android.html ) and then used JDBC to connect with a mysql server. Add this line to your gradle dependency (in case of android)
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'
and code in the same way as you do for a simple java jdbc program, you can connect to a database and perform operations on it. If you need further clarity please comment.
Im currently building a web app heavily based on MongoDB and Mongoose for the web app backend. The app will also have a desktop version based on electron. However as far as I’ve researched, including stackoverflow, you can’t package MongoDB with an electron app. The app might not be connected to the internet all the time. And hence I need a local store for it as well. This is where I want to use something like CouchDB or PouchDB.
The implementation I have come up with is this:
Store the data in a CouchDB/PouchDB
Check if there’s an Internet connection
If a connection can be established match the online MongoDB with the local CouchDB/PouchDB and add any entries not present in the database to MongoDB.
What I’d like to ask is if there’s a betterway to go about this?
I need to store some data as part of my electron application. I know how to set up a REST API, and serve my application like so. However, is it also possible to use (e.g.) MongoDB locally, and implement something similar to a REST API locally? I would like to not assume an internet connection for this project.
If you need to implement a mongoDB like database locally for the application without internet, you can use lowdb
Yes it is possible, you have nodejs in electron so you can use mongoose:
https://github.com/Automattic/mongoose
But in this case every person who use your application have to install mongodb in his machine.
I have an Epress JS rest api that posts values to the mongoDB. I'm wondering if it is possible to integrate Meteor JS to retrieve those values from the MongoDB.
Any thoughts would be appreciated.
Thanks
Meteor's data layer connects to MongoDB, use a normal publish on the server and subscribe from the client. https://www.meteor.com/tutorials/blaze/collections
It won't matter that your Express app updates the db independently - Meteor's reactivity will pick up the changes as they happen.
In meteor for creating REST-API the first choice would be a publish-subscribe call but if you need to make REST-API beyond that you can use 'Restivus' high-level API.
Here is the link
I have one meteor 1.0 phonegap application and several meteor servers.
According to the documentation, one can specify the server while building a phongeap cordova application https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration
What I want to do is to set some default server and allow the users of the phonegap application to change the server from the application. How can I do it?
#MeteorAtSO I think the loadbalancer will do for you
The solution for this problem was the following:
I created a package which must be loaded before any other package and which tries to read server address from localStorage. If an address is found there the package sets __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = "theValueFromLocalStorage"
Which results in that the other packages start to refer to the new server the same way as if it was set initially when building the application
The package can be found here https://github.com/partus/meteor-server-picker