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

47 views (last 30 days)
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.

Accepted Answer

Christopher Stapels
Christopher Stapels on 12 Jan 2021
Edited: Christopher Stapels on 12 Jan 2021
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 Comments
Vinod
Vinod on 12 Jan 2021
Edited: Vinod on 12 Jan 2021
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 on 12 Jan 2021
"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.

Sign in to comment.

More Answers (0)

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Read Data from Channel in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!