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

49 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Christopher Stapels
Christopher Stapels el 12 de En. de 2021
Editada: Christopher Stapels el 12 de En. de 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 comentarios
Vinod
Vinod el 12 de En. de 2021
Editada: Vinod el 12 de En. de 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 el 12 de En. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Comunidades de usuarios

Más respuestas en  ThingSpeak Community

Categorías

Más información sobre Read Data from Channel en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by