Raspberry Pi HTTPSocket

  1. last year

    Hi guys i'm trying to create a raspberry pi application that sends HTTP post requests to an API.

    I successfully created it on my mac, using the Xojo.Net.HTTPSocket with my own methods.

    This works 100% fine on my mac and does everything I need it to do, but when I run it on the raspberry pi using the remote debugger it crashes with no error message when I press any of the buttons (buttons initiate requests)

    Dim params As New Xojo.Core.Dictionary
    params.Value("key") = apikey 
    params.Value("identifier") = id
    params.Value("password") = pass
    Dim json As Text
    json = Xojo.Data.GenerateJSON(params)
    Dim data As Xojo.Core.MemoryBlock
    data = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(json)
    Self.SetRequestContent(data, "application/json")
    self.Send("POST", "https:/myapi.example")

    Then the PageRecieved method which exists in an instance of my custom class "http" (inherits from Xojo.Net.HTTPSocket )
    This processes the response data and displays it in a list box:

    if HTTPStatus = 202 then
      Window1.Listbox1.AddRow("------202, Accepted-----")
      if json.HasKey("token") then //ASSUME Response from Login
        Dim t As Text = json.Value("token")
        App.token = t
        Dim e As Integer = json.Value("expires")
        Dim expires As Text = e.ToText
      end if
    end if

    If anyone can help me out I would really appreciate it.

  2. Robin L

    6 Dec 2017 Xojo Inc Europe (Germany, Rehlingen)

    Create a Feedback case, add the project along with any supporting files.

  3. UPDATE: A silly error by me, the URL was missing a slash (https:/) should be (https://)

    Still doesn't explain why it worked on the computer but not the Raspberry

  4. Robin L

    7 Dec 2017 Xojo Inc Europe (Germany, Rehlingen)

    Some browsers might attempt to correct 'silly' mistakes. Edge seems to be quite happy to correct a '/' at the beginning of a URL.

or Sign Up to reply!