thingspeak - Any way to disable "Transfer-Encoding: chunked"?

49 次查看(过去 30 天)
When updating a channel with an execute Talkback(https://www.mathworks.com/help/thingspeak/writedataandexecutetalkbackcommand.html), the thingspeak server uses a chunked style body. With weak and intermittent cellular connections, this can cause difficulties. Is there any way to disable this behavior? I believe updating a channel without Talkback does not use chunked encoding.

采纳的回答

Christopher Stapels
编辑:Christopher Stapels 2021-1-12
Are you sending a very large command to your device? The talkback response should be quite small. We cannot change the encoding on the response that is sent from a TalkBack, but you can use a ThingSpeak channel as a proxy for TalkBack. Write the command to a channel and have the device read the channel at regular intervals or use MQTT to subscribe to the channel. The subscription will provide the channel contents when they are updated.
  3 个评论
Vinod
Vinod 2021-1-12
编辑:Vinod 2021-1-12
Try adding "&headers=false" to your request. That should shorten it up and cause the response to be less likely to be chunked.
Also, are you sending a HTTP/1.1 or HTTP/1.0 request? Try sending a HTTP/1.0 if your device cannot handle a HTTP/1.1 request.
Zachariah Belding
Zachariah Belding 2021-1-12
"Try adding "&headers=false" to your request. That should shorten it up and cause the response to be less likely to be chunked."
Thank you! This will shorten the response quite a bit and reduce data usage!
HTTP/1.1 200 OK
Date: Tue, 12 Jan 2021 11:35:37 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
ETag: W/"050a4384880d48b11dc203846aea209c"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 79cb41b5-e471-4a0e-9201-f0f45b21581b
X-Runtime: 0.074885
X-Powered-By: Phusion Passenger 4.0.57
Server: nginx/1.9.3 + Phusion Passenger 4.0.57
86
{"executed_at":"2021-01-12T11:35:37Z","position":null,"id":21390658,"command_string":"146wateron","created_at":"2021-01-12T11:33:06Z"}
0
After looking at my issue more, I have determined that I was wrong about the chunked encoding. I am working with raw tcp sockets and I was not giving the response enough time to be fully buffered in the cellular modem I am using. Adding a 250ms delay after the modem first tells me data is available seems to have fixed the issue.

请先登录,再进行评论。

更多回答(0 个)

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 Read Data from Channel 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by