Net::HTTP, Threads and AJAX

S

skuunk

Hello,
I was wondering if anyone had solved this issue before.

Basically I am calling a 3rd party information service using Net::HTTP
which I would like to proxy through my Rails app so that I can access
it via an xmlhttp request using JavaScript.

This service is not 100% reliable so while I can set a small timeout,
while the service is being pinged it stops all the other processes
from being run. I would like to set it up so that it happens as a
background process and then after a certain amount of time pops up.

I have tried the following, but all that happens is that Rails
complains that it can't find a template.

def index
wgw_server = WGWServer.new
Thread.new {
render :text => wgw_server.proxy(params[:id] + '?' +
request.env['QUERY_STRING'], params[:callback],
params[:callbackParam])
}
end

wgw_server.proxy contains the code which handles the Net::HTTP
request.

Any ideas?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top