如何将 pinoccio 连接到 apache couchdb [英] How to connect pinoccio to apache couchdb

查看:26
本文介绍了如何将 pinoccio 连接到 apache couchdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人在使用 www.pinocc.io 的不错的 pinoccio ?

Is there anyone using the nice pinoccio from www.pinocc.io ?

我想用它通过 node.js 将数据发布到 apache couchdb.所以我试图从 pinnocio API 中轮询数据,但我有点迷茫:

I want to use it to post data into an apache couchdb using node.js. So I'm trying to poll data from the pinnocio API, but I'm a little lost:

  • 安排投票
  • 进行长时间的民意调查
  • 采用完全不同的方法

欢迎任何想法

皮特

推荐答案

好的.我编写了 Pinoccio API,这是你如何做的

Sure. I wrote the Pinoccio API, here’s how you do it

https://gist.github.com/soldair/c11d6ae6f4bead140838

此示例依赖于 pinoccio npm 模块 ~0.1.3,因此请确保再次 npm install 以获取最新版本.

This example depends on the pinoccio npm module ~0.1.3 so make sure to npm install again to pick up the newest version.

您不需要轮询,因为如果您与stats"或sync"打开连接,pinoccio 会在发生更改时向您发送更改.如果你想投票,你可以,但不是实时".

you don't need to poll because pinoccio will send you changes as they happen if you have an open connection to either "stats" or "sync". if you want to poll you can but its not "real time".

sync 为您提供当前状态 + 发生的流变化.所以它完美,如果你只需要在脚本运行时保存对部队的更改.或在网页上显示当前和上次已知状态.

sync gives you the current state + streams changes as they happen. so its perfect if you only need to save the changes to your troop while your script is running. or show the current and last known state on a web page.

复制我们存储的每个数据点的解决方案是stats.这是提供的示例.Stats 可让您了解球探发生的一切.例如,数字引脚是数字"报告.您可以从特定时间点或仅从当前时间(默认)请求数据.对此数字"报告的更改将继续实时流式传输,直到到达结束"时间,或者如果传递给 stats 的选项中的tail"等于 0.

The solution that replicates every data point we store is stats. This is the example provided. Stats lets you read everything that has happened to a scout. Digital pins for example are the "digital" report. You can ask for data from a specific point in time or just from the current time (default). Changes to this "digital" report will continue streaming live as they happen, until the "end" time is reached, or if "tail" equals 0 in the options passed to stats.

希望这有帮助.我在我当地的沙发上测试了脚本,效果很好.您需要修改它以从每个球探复制更多统计数据.我希望很快您就可以从同一流中的多个侦察员那里请求多个报告.我只是有一些错误需要解决;)

hope this helps. i tested the script on my local couch and it worked well. you would need to modify it to copy more stats from each scout. I hope that soon you will be able to request multiple reports from multiple scouts in the same stream. i just have some bugs to sort out ;)

这篇关于如何将 pinoccio 连接到 apache couchdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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