• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP Tunneling - without polling, for a games website

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Grant Digby
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic