I have a Java server (no external libraries and does not use sun.net.httpserver
package)
I would like to have the client open a connection with the server and wait until the server sends an update. The problem with this is that certain browsers (for example IE11) will use the AJAX socket to send a new request (for example GET / HTTP/1.1
) and the problem with that is that it causes my server to crash. I could close the socket upon closing the webpage but then the client would have to open a new socket to send another HTTP request.
Is there an efficient way of doing this?
Edit: Another question... Is there a way to listen for changes on a socket's input stream using Java?