Reputation: 5879
What would be the best way to create a JS chat client with GWT? The bit that I'm having trouble with is the persistence and transfer of the messages. Should I store the messages in a DB and check the db for new messages? Is there a much better way to do this?
Upvotes: 5
Views: 3524
Reputation: 15331
Like jah suggested, you definitely want to use Comet/Server Push/Reverse AJAX/many other names. I've compiled your options for GWT in another post.
If you want a quick start, look at the NGiNX_HTTP_Push_Module - they have an easy to understand chat example. You'll have to write some handling of the protocol yourself, but it's a rather simple task.
If you're using Java too on the backend, the easier solution will be rocket-gwt or cometd.
Upvotes: 3
Reputation: 2141
You could either have connected clients continuously poll the server for new messages or you could have a look at Server Push: http://code.google.com/p/google-web-toolkit-incubator/wiki/ServerPushFAQ
Upvotes: 2