一个Pinoccio铅球探怎样才能使一个POST请求到远程服务器? [英] How can a Pinoccio lead scout make a POST request to a remote server?

查看:170
本文介绍了一个Pinoccio铅球探怎样才能使一个POST请求到远程服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的 Pinocc.io 铅球探作出POST请求(例如通知的远程服务已触发的事件)。

I'd like my Pinocc.io lead scout to make a POST request (e.g. to inform a remote service of an event that has been triggered).

请注意,我不希望(这里详细的)听络绎不绝的结果我不不想被不断地连接到总部(我要去实现,只需要以尽量减少电池的使用的Wi-Fi连接),而我检测事件是罕见的。

Note that I don't want to listen to a constant stream the results (as detailed here) as I don't want to be constantly connected to the HQ (I'm going to enable the wi-fi connection only when required to minimize battery usage), and the events I'm detecting are infrequent.

我还以为这是一个很常见的情况,但我找不到任何铅球探公布任何消息的示例。

I would have thought that this is a very common use case, yet I can find no examples of the lead scout POSTing any messages.

推荐答案

我直接发布同样的信息上的 Pinoccio网站我从管理员

I posted the same message directly on the Pinoccio website and I got this answer from an Admin

出了大门,这不是通过总部的支持。主要是因为得到尽可能
  API / HQ和首席球探之间的实时性能,它使最
  感觉离开TCP套接字不断开放和传输数据
  办法。 HTTP,如你所知,需要一个连接,设置,转移,
  在每次请求拆除。

Out of the gate, that's not supported via HQ. Mainly because to get as real-time performance between API/HQ and a Lead Scout, it makes most sense to leave a TCP socket open continually, and transfer data that way. HTTP, as you know, requires a connection, setup, transfer, and teardown upon each request.

但是,这并不意味着你不能得到它
  加工。事实上,你可以两者都做,如果你想,离开主TCP
  插座连接到总部,并有一个独立的TCP客户端套接字连接
  到任何网站/服务器你想和发送任何你喜欢的。它会
  需要自定义引导,但你可以再揭露任何方面
  功能HQ / ScoutScript直接
的。

However, doesn't mean you can't get it working. In fact, you can do both if you wanted—leave the main TCP socket connected to HQ, and have a separate TCP client socket connect to any site/server you want and send whatever you like. It will require a custom Bootstrap, but you can then expose any aspect of that functionality to HQ/ScoutScript directly.

如果你看看这个<一个href=\"https://github.com/Pinoccio/library-pinoccio/blob/master/src/backpacks/wifi/WiFiBackpack.h#L55\"相对=nofollow> code ,这是客户对象,你会用它来打开HTTP连接。

If you take a look at this code, that's the client object you'd use to open an HTTP connection.

所以,简而言之领先侦察无法进行POST请求。要做到这一点,你需要创建(例如,使用Arduino的IDE)自定义引导。

So in a nutshell the lead scout cannot make a POST request. To do so you'll need to create a custom bootstrap (e.g. using the Arduino IDE).

这篇关于一个Pinoccio铅球探怎样才能使一个POST请求到远程服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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