I use an API that you pass a callback into and get an fd in response. You then monitor the fd and invoke a process function when there's something to read which results in your callback being fired with results. I haven't checked js-ctypes for some time so I could be wrong about this type of thing not being possible with it.
I figure if I'm going to do a rewrite I might as well go down the NPAPI path (via http://www.firebreath.org/) as then I can pick up Chrome.