node.js - 如何通过cakePHP访问NodeJS数据?

标签 node.js cakephp arduino raspberry-pi

这里是一个虚拟问题,但我暂时在网上没有找到任何答案。

我正在开发一个 cakephp 网站,安装在 Raspberry Pi 上,该网站应该能够通过本地网络无线连接到 Arduino YUN,获取其组件列表。

例如:

"A LED is connected on ports :

Input : 2,

Output : 6;

and is currently on"

并更改输入值:

"turn the LED off"

我不应该重新加载网页来查看发生的更改。 所以我发现我需要 NodeJS 使用 websockets 发送/接收信息但是我不知道如何将 NodeJS(在其自己的网络服务器上运行)连接到 cakephp。 我是 NodeJS 的菜鸟,之前刚刚看了一些教程,所以我被困在这里了。

有人知道如何处理吗?

提前致谢,

最佳答案

您可以使用一些不同的库来连接到 Node 服务器。

http://elephant.io/

https://github.com/bergie/dnode-php

当然,您可以直接从 cakephp 应用程序向 Node 服务器发送 http 请求(curl)。

关于node.js - 如何通过cakePHP访问NodeJS数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22158986/

相关文章:

javascript - Dataloader 如何缓存和批处理数据库请求?

html - CakePHP 图像链接

node.js - 无法运行 NPM 获取错误 : Cannot find module 'are-we-there-yet'

node.js - Node js Json 添加数组

sql - 我怎样才能在cake php中进行sql联合?

php - 在 CakePHP 中自动将数据从日期时间字段转换为特定格式

c++ - MQTT client.publish 的 char, const char char* 数组问题

python - Pyfirmata Arduino : Could not Open Port (Serial Exception)

android - 将数据从 Android 发送到 Simblee BLE 不返回任何内容

javascript - 为什么这个简单的函数不能在这个 javascript 状态机中的这个对象上运行?