Forums Register Login

HTTP Tunneling - without polling, for a games website

+Pie Number of slices to send: Send
I'm building a website which consists of JSP pages and a gaming Applet talking to a Servlet hosted on Tomcat 4.0.
All is working well, but scalability is going to be a major issue.
The problem lies with the request - response http protocol. First Applet sends their move to the Servlet. The Servlet has no way of letting the opponent's applet know it's received the next move so the opponents applet has had to constantly poll the servlet to see if a move has been delivered. When a poll returns the move, the original applet is now hammering the servlet waiting for the next move.
Currently my only HTTP solution is to tell the applets to poll only once every 5 seconds to reduce requests. If I use normal sockets I can have controlled 2 way communication (the applet can sleep until it's told there's a move), but it won't got through firewalls - and why would you go to work if you couldn't play once there?!
Do you know of a suitable solution to this problem?
Grant.
+Pie Number of slices to send: Send
Keep the HTTP connection open for updates - you can simply let the servlet run in a loop, waiting for updates to send to the applet. The applet can treat the POST as a never-ending socket connection.
Send moves on separate POSTs.
All of this will require some sort of server-wide status cache, but I'm presuming you're storing the game state there anyway.
+Pie Number of slices to send: Send
Cheers for your reply, seems it will be more efficient than polling so probably the way I'm going to go.
I did get another suggestion..
"SSL tunnelling will provide you with a constant streaming connection to whatever port you like (so not just port 80) although relies on the firewall supporting SSL. It's very powerful because you don't have to put up with the limitations of HTTP, as you can use whatever protocol you like within the SSL stream, such as CORBA which would give you luxuries like callbacks (so the client could be called when it's their turn, rather than the client having to poll)."
I assume that with SSL I'll have problems with certificate warnings appearing to the client. I'll have to have a play with both.
Grant.
Everybody's invited. Even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 855 times.
Similar Threads
Question about java.lang.SecurityException
Long Polling
how does the servlet knows that the client has closed the browser
How does this actually solve Towers of Hanoi?
Implementing a message broadcast server using servlets
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 04:00:37.