流星与节点之间的双向通信 [英] Two-way communication between Meteor and Node

查看:98
本文介绍了流星与节点之间的双向通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Node应用程序,该应用程序通过串行方式与Xbee通信,并读取/控制多个也具有Xbee功能的传感器/继电器.我想将Meteor用于Node接口应用程序的用户界面和数据存储,只需在Meteor应用程序触发时发送传感器更新并控制继电器.在Node和Meteor应用之间进行通信的正确方法是什么?我知道我可以使用Node DDP客户端将传感器读数插入Meteor应用程序.我遇到的问题是将命令从Meteor发送到Node应用程序以控制中继.我只需要发送一个命令,该命令将在Node应用程序上执行某些代码以切换中继.也许这是一个简单的问题,但是我不确定实现此目的的最佳方法.预先感谢您的任何投入.

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.

推荐答案

您可以仅将Mongo用作集成点.每个XBee设备都可以只是mongo文档.

You could just use Mongo as your point of integration. Each XBee device could just be a mongo document.

{
   address: 'xbeeaddress',
   relay1:  'on'
}

这篇关于流星与节点之间的双向通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆