Dénes
Dénes

Reputation: 113

Java server android client

I'm making a multiplayer game on android, which will communicate with a Java server. (and the server communicate with a database). There will be a lot of clients...
I'm started with a webapplication with glassfish server, generated the entity classes from the database, then generated facadeREST classes from entities. I tried to use HTTP request-response communication, and it was simple. But! There is a problem:

Only the client can start communication, the server can only watch, and response for the requests. Several times, I need the server to start the communication with some client. With HTTP request, I can make only something like that: the client send a request in every 10 sec, and the server response, if there is a message for this client. But this is not the way I'd like to do it. I'm sure that there is a better solution.

I'm looking for a way, that is simple. it would be good, if I could use glassfish or other servers to solve the multithreading.

Upvotes: 2

Views: 735

Answers (2)

Jimmy
Jimmy

Reputation: 16428

What you need my friend is C2DM!

It'll cut the need for your clients to keep polling, instead you have the cloud initiate the communication via push notifications.

In regards to application server, if your app follows Java EE standards then you should be able to deploy it to any old Java EE container. I'd recommend taking advantages of the free Java hosting on offer by CloudBees, just drop in your WAR as you would onto glassfish.

In regards to what your application actually needs to do, I can't advise since you didn't give any specifics :S

...And no, I don't work for Cloudbees, I just think they're awesome

Upvotes: 3

Code Droid
Code Droid

Reputation: 10472

NodeJS in a WebView is the answer

Upvotes: 1

Related Questions