liran
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
04:49 AM
[SOLVED] Async HTTP requests
Hello
I am trying to make an Asynchronous HTTP request by his code:
http = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
http.SetPort(port)
http.SetUrl("http://mysite.com") ' should return response in up to 30 seconds.
' SSL certicate, a must for HTTPS addresses !
http.SetCertificatesFile("common:/certs/ca-bundle.crt")
rsp = http.AsyncGetToString()
message = wait(0,port)
print message.GetResponseCode()
print message.GetString()
print message.GetFailureReason()
And it fails:
-28
Connection time-out
What is the reason for this ?
Thanks
I am trying to make an Asynchronous HTTP request by his code:
http = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
http.SetPort(port)
http.SetUrl("http://mysite.com") ' should return response in up to 30 seconds.
' SSL certicate, a must for HTTPS addresses !
http.SetCertificatesFile("common:/certs/ca-bundle.crt")
rsp = http.AsyncGetToString()
message = wait(0,port)
print message.GetResponseCode()
print message.GetString()
print message.GetFailureReason()
And it fails:
-28
Connection time-out
What is the reason for this ?
Thanks
7 REPLIES 7
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
08:35 AM
Re: Async HTTP requests
Is your server sending any response to the roku? What happens when you pull it up in your browser?
liran
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
08:36 AM
Re: Async HTTP requests
The response is shown at the browser, after 30 seconds max (on purpose).
This is why I want to handle it asynchronously, and it doesn't work.
This is why I want to handle it asynchronously, and it doesn't work.
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
08:39 AM
Re: Async HTTP requests
What if you lower the time for the response for testing? Maybe try 1 second, see if that works, then try 5 seconds, 10, 15, 20, until it fails? If it always fails then that will indicate perhaps the response itself is the problem...or could be the certificate.

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
11:23 AM
Re: Async HTTP requests
"liran" wrote:
The response is shown at the browser, after 30 seconds max (on purpose).
This is why I want to handle it asynchronously, and it doesn't work.
I seem to recall, in my testing, there being a built-in 30 second timeout in the roUrlTransfer component, but I'm not 100% sure about that. I'd definitely try what destruk suggests. Your code also appears to be missing the call to InitClientCertificates which could also be causing a problem.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
12:17 PM
Re: Async HTTP requests
Yes, there's a 30 second connection timeout. I don't think there's a way to change it right now.
--Mark
--Mark
liran
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2011
10:48 PM
Re: Async HTTP requests
The time-out is not from the server ! Even when I define at the server to response after 1 second, at the browser the response is gotten after 1 second - My code get stuck at:
message = wait(0,port)
Until about 30~ seconds have passed, the message doesn't get to the port or something.
What's wrong with my code ?
Thanks
message = wait(0,port)
Until about 30~ seconds have passed, the message doesn't get to the port or something.
What's wrong with my code ?
Thanks

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2011
04:53 PM
Re: Async HTTP requests
If you send me the link you are trying to connect to, I'll try to diagnose the problem with you. You can PM me the link if you'd like.
--Kevin
--Kevin