ryano_
you don't need to switch the library, but need a layer in between.
you can make something like:
create 2 queues (requests and responses) with data and a chai callback
create a worker thread that wakes up when requests not empty, process them and store the result in responses queue.
create a hook at server frame, if responses not empty, call the chai callback with the response data.
and the chai functions ('http_get '...) just store the data and callback in requests queue.