GraftJS / graft

full-stack javascript through microservices
http://graft.io
MIT License
227 stars 15 forks source link

question(s): overlap with messaging protocols (IoT)? #20

Open boneskull opened 9 years ago

boneskull commented 9 years ago

I just discovered this project, and my interest is sparked.

Say I wanted to get real-time data from a sensor and pipe it "somewhere". Would Graft help me do that?

I do understand libchan is more of a request/response thing, but the README.md also mentions it's possible to use it for asynchronous messaging (though, unfortunately, this is not elaborated upon).

I also understand a goal of Graft is ease integration with the browser. This is something I may want to take advantage of, but for now let's just say my data is going to go "somewhere".

It seems like devices want to work over things like RabbitMQ, MQTT, etc. I get the impression these protocols are popular because they are simple, and can be deployed on devices with memory/storage constraints.

But it also seems (and I may be wrong here) that publishing the same message every n milliseconds (in the interest of providing "real-time" data) would be inefficient and potentially slow--especially since the published message would have to go through a broker. Naturally, a stream or socket--with a direct connection--would make more sense, right? And it'd make even more sense if the "endpoint" wasn't necessarily a browser, but another device?


Imagine some sort of setup wherein you were monitoring electricity usage. If the electricity usage gets too high, you wish to reduce it. Say you want to dim the lights by some function of the usage, and then brighten the lights again if the usage goes back down.

So perhaps you would have your meter open a socket to some server, which would then transform the data through your function, and pipe the data to a dimmer, which would reduce or increase the brightness as necessary.

But perhaps then you're using too much juice and the lights are all but off. At this point, you still need to reduce the power consumption. So then somebody (not sure which microservice) would then tell the climate control system to take it easy. And so on, and so forth.

Oh, and you want to see a dashboard in a browser of all this craziness.

Is libchan, and thus Graft, a solution?

AdrianRossouw commented 9 years ago

Why don't you come join us on gitter? so we can answer all these questions for you.

One of the co-founders is very involved in IoT things, and you may also want to check out his slides : http://mcollina.github.io/nodeconfeu-2014-full-stack-through-microservices/

https://gitter.im/GraftJS/graft?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge

mcdonnelldean commented 9 years ago

Hey,

I wholeheartedly think you should jump on to Gitter too for this style of question, but to answer your question YES! Let me link you to a video that shows @mcollina using a little Texas Instruments sensortag to get real time info and control his slides with Graft.

Ultimately at a high level, you're just dealing with streams of data, because of this it makes 'real time' easier to reason about.

https://www.youtube.com/watch?v=C_w1iNQMWlM

boneskull commented 9 years ago

Yeah I saw those slides but it was still unclear. I'm here because of @mcollina's other work. I'll join gitter

EDIT: I saw @mcollina 's slides from nodeconf eu. I didn't see this youtube video. Thanks!