Hi!
I want to connect to an api to implement some of it’s features on my app. but for some reason when want to set the request header and send a GET request and i launch my app it instantly tells me “Debug application stopped responding” and crashes, please can someone help me out. Here is my code:
I have my Xojo.Net.HTTPsocket as a class in a module called DiscordSocket with a PageReceived event .
I have a property in Session called Message where i store the value from the socket’s PageReceived event when i get a response.
I access the class on my main webpage Shown event with this:
DIM DiscordSocket AS NEW DiscordApi.DiscordSocket
DiscordSocket.RequestHeader("Authorization") = "Bot 989afsahjfag6asfkljas8asvgajhsv6ao3asgcha6wrwqr"
DiscordSocket.Send("GET", "https://discordapp.com/api/channels/230833430827499520/messages")
ListBox1.AddRow("Received: ") + Session.Message
This is my code in the PageReceived event:
Dim buffer As Text = Xojo.Core.TextEncoding.UTF8.ConvertDataToText(Content)
Session.Message = buffer
In the app’s HandleUrl i have this code:
Dim sessionContext As New WebSessionContext(Self.SessionWithIdentifier(SessionID))
IF Request.Path = "discord" THEN
DIM DC AS NEW MainPage
DC.ListBox1.AddRow("RAW : " + Request.Entity)
DIM content AS STRING
content = Request.Entity
DC.ListBox1.AddRow("Recieved Post: " + content)
Request.Status = 200
Return True
END IF
The redirect url on the API is http://MyIPhere/discord
I have no clue if this code is sufficient enough for it to work but i cant figure out why my app keeps crashing, please can someone help me out.
Thanks in advance!
- Dian