So I'm facing a challenge to develop a web application which would have to display real time data coming from remote server. To connect to this remote location I'd need TCP sockets and some arbitrary protocol(not HTTP). 

My goal is to have the web server connect to the other server, keep the connection alive indefinitely and continuously read data while displaying that data in real time on the website.

Now my question is, how would I go about this using Java EE? I could also develop completely separate software to handle the outgoing TCP connection, but how then would I handle communication between web app and this other software?