简体   繁体   English

Pinoccio首席侦察员如何向远程服务器发出POST请求?

[英]How can a Pinoccio lead scout make a POST request to a remote server?

I'd like my Pinocc.io lead scout to make a POST request (eg to inform a remote service of an event that has been triggered). 我希望我的Pinocc.io主管侦察员发出POST请求(例如,将已触发的事件通知远程服务)。

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. 请注意,我不想要听络绎不绝的结果(详见这里 ),因为我不想被不断地连接到总部(我会仅在需要时尽量减少使Wi-Fi连接不电池电量),并且我检测到的事件很少发生。

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. 我本以为这是一个非常常见的用例,但是我找不到引导侦察员发布任何消息的示例。

I posted the same message directly on the Pinoccio website and I got this answer from an Admin 我直接在Pinoccio网站上发布了相同的消息,我从管理员那里得到了这个答案

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. 主要是因为要在API / HQ和Lead Scout之间获得实时性能,最有意义的是保持TCP套接字连续打开,并以这种方式传输数据。 HTTP, as you know, requires a connection, setup, transfer, and teardown upon each request. 如您所知,HTTP要求在每个请求时进行连接,设置,传输和拆除。

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. 实际上,您可以根据需要执行以下两项操作:将主TCP套接字连接到HQ,并使用单独的TCP客户端套接字连接到您想要的任何站点/服务器,然后发送您想要的任何内容。 It will require a custom Bootstrap, but you can then expose any aspect of that functionality to HQ/ScoutScript directly . 这将需要一个自定义的Bootstrap,但是您可以将该功能的任何方面直接暴露给HQ / ScoutScript

If you take a look at this code , that's the client object you'd use to open an HTTP connection. 如果您看一下这段代码 ,这就是您用来打开HTTP连接的客户端对象。

So in a nutshell the lead scout cannot make a POST request. 简而言之,侦察员无法发出POST请求。 To do so you'll need to create a custom bootstrap (eg using the Arduino IDE). 为此,您需要创建一个自定义引导程序(例如,使用Arduino IDE)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Pinoccio连接到Apache CouchDB - How to connect pinoccio to apache couchdb 带有WiFi Shield的Arduino发出奇怪的帖子请求 - Arduino with WiFi Shield make weird post request 如何使用支持多个文件的 arduino 制作 web 服务器? - How can I make a web server with arduino that support multiple file? 无法通过NodeMCU将POST请求发送到服务器 - Cant sent POST request to server with NodeMCU 如何使用 ESP32 上的 http 客户端请求进行正确的 POST(错误:“站点名称的 DNS 失败”) - How to make a correct POST with http client request on ESP32 (error: “DNS Failed for sitename”) 如何将Arduino连接到远程处理服务器? - How to connect Arduino to remote processing server? 在Arduino上从Node JS服务器接收POST请求 - Receving POST request from Node JS server on Arduino 在使用带有 SIM7000A 模块和 Arduino 的 HTTP AT 命令发送 POST 请求时,如何包含正文? - How can I include a body while sending a POST request using HTTP AT commands with a SIM7000A module and an Arduino? esp8266 POST请求后服务器没有响应 - No response from server after a esp8266 POST request 如何让arduino使用wifi将传感器数据发送到服务器? - How can i make arduino send sensor data to server using wifi?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM