Pinoccio 首席侦察兵如何向远程服务器发出 POST 请求? [英] How can a Pinoccio lead scout make a POST request to a remote server?

查看:25
本文介绍了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 和 Lead Scout 之间的实时性能,它使最感觉让 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 客户端套接字连接到您想要的任何站点/服务器并发送您喜欢的任何内容.它会需要自定义 Bootstrap,但您可以 暴露任何方面直接向 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.

如果你看看这个 代码,这是您用来打开 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天全站免登陆