Question

I set up mini server using com.sun.net.httpserver as part of application which has ability to map files from hard disk and send them as response, just simple stuff for now (js, css, images, html).

My requirement is to talk to server with little overhead as possible, for now I am using jQuery ajax HEAD requests to send request back to server(I am parsing querystrings on server and do required action according to querystring)

But this is too slow for my needs, it takes 1-2 seconds(sometimes more) to recive request in my code where querystring gets parsed, and often connection gets clogged by too much requests, which I solved partially by timeouts and timers, but doing that only slows down whole thing.

Is there another, faster way to talk to server using js/jQuery?

Maybe something like reverse long polling? Is there such a thing? I assume establishing the connection each time adds lot of overhead, or am I wrong?

Was it helpful?

Solution

I tried jWebSocket and I got almost realtime communication between mobile device and jWebSocket server in Java application. It was little harder to set up due to lack of documentation, but speed got HUGE improvement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top