문제

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).

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.

도움이 되었습니까?

해결책

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

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.

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.

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

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top