P/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
X-Powered-By
The most time something from the response is cut off and every request its a different length.
very rare i get the desired JSON, but also there some bytes are missing
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 600
#End Region
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
If wifi.Connect("dlink") Then
Log("Connected to router.")
Else
Log("Failed to connect to router.")
Return
End If
HttpJob.Initialize("Example")
HttpJob.Download("http://api.apixu.com/v1/current.json?key=302824eba4de44efa0a134505181911&q=Maintal")
End Sub
Sub JobDone (Job As JobResult)
Log("*******************************")
Log("JobName: ", Job.JobName)
If Job.Success Then
Log("Response: ", Job.Response)
Else
Log("ErrorMessage: ", Job.ErrorMessage)
Log("Status: ", Job.Status)
Log(Job.Response)
End If
End Sub
thats really weird
I think its exactly the same (exept the project size)
Ive uploaded my project inkl. the needed (modified) Libs.
The magic happens in WeatherApp.bas
Stop before the httpJob and start after response doesnt work.
B4X:
Sub inizialize
socket.Initialize(51042, "server_NewConnection")
Start
End Sub
Sub Start
udp.Initialize(52829,"PacketArrived")
socket.Listen
End Sub
Sub Stop
udp.Close
socket.Socket.Close
End Sub