URL Connection - Console Pi

Hi
Am new to Console and am using Pi4
I try to send JSON using URL connection
my code as below:

Run Event:
WebConnection = New URLConnection1
WebConnection.SetRequestContent(postData, “application/json”)
WebConnection.Send(“POST”, “EndPoint”)
App.DoEvents(1000)

Content Received Code:
Dim reply As String
reply = content
Print("reply: “+reply+” : " + DateTime.Now.SQLDateTime)

JSON can send successfully to EndPoint , but I cannot capture the reply which is from End Point.

If I change this one
While True
App.DoEvents
Wend
Instead of App.DoEvents(1000) this i get reply.
But I don’t want to use with while loop.
Please advice on this.

Use http://documentation.xojo.com/api/networking/urlconnection.html#urlconnection-sendSync instead so your app waits for the response.

1 Like