Confused about responseContent from WebX.GotText

My AI app is talking to an Arduino which is acting as a web server. I am trying to pass information back to my app as a response to a GET request which the app makes to the Arduino. I'm having no luck thus far. In my sketch, I have total control over how the response appears. Right now, the only header info I'm putting in the response is:

HTTP/1.1 200 OK
Content-type:text/html

After that, the response body consists of various stuff, depending upon the GET, generally consisting of multiple lines of text.

As a test, I have a button whose "click" event sends a GET to which the Arduino responds with a message body consisting of two lines that look something like:

Latitude is 36, longitude is -79
sunset = 17:08 local time (UTC -5 hrs), last updated day 27

I then update the button's text with "get responseContent" and am seeing nothing.

Do I need to put more info in the header in order for AI to see the responseContent properly ?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Sorry about that - lazy thinking I could explain it verbally ... So I have created a small test case.

blocks (1)

Pretty self-explanatory I think. When I click Button1, I send a GET request to the Arduino (which lives on my wifi LAN) of "Xon". WebX.GotText should put the response into Button1.text.

And it does ! When I made this test-case, I defined a new response in my sketch that is only two words, and indeed those words appear in the text of Button1. When I was working on this earlier, the response was two lines (as I described in OP). I'm not sure what I expected to see in Button1.text when responseContent was two lines (instead of two words), but I did not expect to see nothing at all (just background color replaced the initial "Text for Button 1").

Would responseContent have contained the entire two lines of my previous longer response ? Am I not understanding what would happen if I set a button's text to such a large object (and containing newlines as well as spaces) ?

You may be better off putting the response content into a label, which will expand more readily to the content (if sizing is set to automatic)

Same thing happened putting the response in a label. But another of my "commands" (a GET call that solicits a response from the Arduino) that gives a multi-line response, worked just fine.

So something about that first command I tried. No worries, whatever it is, I can easily work around it.