GWT Chat applications

1,764 views
Skip to first unread message

abhiram

unread,
Dec 9, 2009, 7:13:16 AM12/9/09
to Google Web Toolkit
Hi All,

Can someone tell me which is the best (and convenient) method to
implement a chat application for my web page using GWT?

I believed using the comet.jar would be neat but had lot of problem
implementin it. Can you please tell me which is the best possible
approach? with any working examples / links?

~ Abhiram

P.G.Taboada

unread,
Dec 9, 2009, 8:48:45 AM12/9/09
to Google Web Toolkit
I personally would not push the messages from the server, but have the
clients polling.

The rest is server-side coding. What backend are you targeting?
Don't forget that you will have to handle thread-safety issues on the
server side.

brgds,

Papick G. Taboada

abhiram wuntakal

unread,
Dec 9, 2009, 8:52:39 AM12/9/09
to google-we...@googlegroups.com
But, client side polling would make the system slow right? and how to do I decide the frequency of polling?

Backend is pure Java with the database interaction thru hibernate.

~ Abhi

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



P.G.Taboada

unread,
Dec 9, 2009, 9:10:09 AM12/9/09
to Google Web Toolkit
Slow on what end?

Sure, pushing from server would lead to instant message delivery, but
I don't think it scales very well.
Do you know how may connections you can keep open?
You could change the polling rate depending on the load status of the
server, just a thought.


brgds,

Papick

On 9 Dez., 14:52, abhiram wuntakal <abhir...@gmail.com> wrote:
> But, client side polling would make the system slow right? and how to do I
> decide the frequency of polling?
>
> Backend is pure Java with the database interaction thru hibernate.
>
> ~ Abhi
>
> On Wed, Dec 9, 2009 at 7:18 PM, P.G.Taboada <pgtabo...@googlemail.com>wrote:
>
>
>
> > I personally would not push the messages from the server, but have the
> > clients polling.
>
> > The rest is server-side coding. What backend are you targeting?
> > Don't forget that you will have to handle thread-safety issues on the
> > server side.
>
> > brgds,
>
> > Papick G. Taboada
>
> > On 9 Dez., 13:13, abhiram <abhir...@gmail.com> wrote:
> > > Hi All,
>
> > >    Can someone tell me which is the best (and convenient) method to
> > > implement a chat application for my web page using GWT?
>
> > >   I believed using the comet.jar would be neat but had lot of problem
> > > implementin it. Can you please tell me which is the best possible
> > > approach? with any working examples / links?
>
> > > ~ Abhiram
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-we...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .

Jim

unread,
Dec 9, 2009, 11:40:00 AM12/9/09
to Google Web Toolkit
hi, I've implemented a gwt Chat

the link http://code.google.com/p/google-web-toolkit-incubator/wiki/ServerPushFAQ
helps me.

From client, i do an rpc call
--> server-side, i'm waiting for event (using a timer) for the
client :
-- if i got an event for the client, i return to the client, and i do
again the rpc call.
-- if no events after 40 sec, i return to the client and says to the
client "No events!", and i do again the rpc call.

abhiram wuntakal

unread,
Dec 10, 2009, 5:19:10 AM12/10/09
to google-we...@googlegroups.com
Hi jim,

Thanks for that hint.

  Well, are u getting the messages from the database? I mean there shud be a place from where the messages intended for a client shud be picked up right? So, have u kept the messages in the databse?

 And are u able to support multiple chat windows for a single user who is chatting with many people?

  Regards,
Abhiram

 

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

Jim

unread,
Dec 10, 2009, 6:21:27 AM12/10/09
to Google Web Toolkit
No i don't use database,
Server side, i've got
- an static hashmap<idUser,usermodel> with all users online. ( add and
remove users by connectionEvents received from client)
- an static hashmap<idUser,Event> to know wich events to which
client .

for example :
- on the client,
=>jim connect --> that sends an eventConnection to server --
> add jim_user to the hashmap and return to client
- another client;
=>Abhiram connect --> that sends an eventConnection to server
--> add_Abhiram_user to the hashmap, add the events to other users
( hashmap<Jim_User,Event>)
so jim_user receive the event and jim_user knows that Abhiram is
connected

- jim want to says something to all other user --> jim users send a
messageEvent to the server ( for all keyset of the
hashmap<idUser,Event> )
.......
.....
- jim want to speak with Abhiram only) --> send a messageEvent to the
server and put only the event for the hashmap<Abhiram_user,Event> ...

sorry for my english ! I'm Frenchman.
;-)


On Dec 10, 11:19 am, abhiram wuntakal <abhir...@gmail.com> wrote:
> Hi jim,
>
> Thanks for that hint.
>
>   Well, are u getting the messages from the database? I mean there shud be a
> place from where the messages intended for a client shud be picked up right?
> So, have u kept the messages in the databse?
>
>  And are u able to support multiple chat windows for a single user who is
> chatting with many people?
>
>   Regards,
> Abhiram
>
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > .

Mohamed Mansour

unread,
Dec 10, 2009, 9:32:14 AM12/10/09
to Google Web Toolkit
I would rather use JMS to do this. You have the power to do so. Every
client writes to some Queue, and registers himself with a ReplyTo
temporary queue. That way the server handles all the messages and
sends the message to the appropriate queue where GWT is listening to.

Kiril Piskunov

unread,
Dec 9, 2009, 1:17:55 PM12/9/09
to Google Web Toolkit
You should check out this example.

http://www.gwtapps.com/?page_id=31
Source:
http://groups.google.com/group/gwtapps/files

It is implementing using hanging async call so if there are no
messages, polling time is reduced to 30 seconds.
For the server side code there author included example using comet as
well. But if you are not going to have many users you can use it
without Comet.

Richard

unread,
Jan 11, 2010, 8:38:02 AM1/11/10
to Google Web Toolkit
My project gwt-comet implements Comet by streaming messages over long
lived HTTP requests to minimise latency and bandwidth requirements and
maximise the throughput. This is opposed to many other implementations
which use polling or long polling techniques.

http://code.google.com/p/gwt-comet/

On Dec 9 2009, 10:13 pm, abhiram <abhir...@gmail.com> wrote:
> Hi All,
>
>    Can someone tell me which is the best (and convenient) method to
> implement a chat application for my web page using GWT?
>

>   I believed using thecomet.jar would be neat but had lot of problem

suresh babu

unread,
Sep 29, 2013, 12:48:10 PM9/29/13
to google-we...@googlegroups.com

I have created chat app using Gwt, Rpc call to store and retrieve, backend I used objectify and Google App engine, 
App link : http://my-health-care.appspot.com/Chat.html , works well and good :) 

Thanks,
Suresh

Manuel

unread,
Sep 29, 2013, 5:20:59 PM9/29/13
to google-we...@googlegroups.com
Maybe you want to go with websockets. Have a look at this example: Chat example

David Levesque

unread,
Sep 30, 2013, 11:03:53 AM9/30/13
to google-we...@googlegroups.com
I have built a chat front-end using GWT, Strophe.js and gwt-strophe (bindings for GWT). Strophe simulates persistent XMPP connections through BOSH. For the server I used Tigase, but it should work with any XMPP complient server. There are many good open source chat servers that allow you to write custom plugins in java (e.g. for authentication and integration with your back-end). Openfire is a popular one.

The advantage of having a separate chat server is that it removes a lot of load (and at lot of long lived connections) from your servlet container. The drawback is that it makes integration with your webapp harder, because you have to write plugins to talk to your backend. But imo it scales better, especially if you're going to have hundreds or thousands of simultaneous chat users.

Basically my GWT app uses GWT-RPC to talk to Tomcat, but the chat stuff does not go to Tomcat. It goes to the standalone Tigase server living on the same machine. All traffic go through port 80 (or 443) and it is routed to either Tomcat or Tigase using reverse proxy rules in Apache Web server.

Unfortunately I can't show you the code or point you to a live example because it was developped for a company I worked for (closed source) and the application is not open to public.

--
David

Timothy Spear

unread,
Sep 30, 2013, 11:07:54 AM9/30/13
to google-we...@googlegroups.com, Timothy Spear
I used get-eventservice to build a custom solution. 
Requirements were for system to client and client to client messaging. Uses one of the two RPC connections most browsers allow JS.
So far working well.

Tim

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.

To post to this group, send email to google-we...@googlegroups.com.

suresh babu

unread,
Oct 6, 2013, 7:51:39 AM10/6/13
to google-we...@googlegroups.com, Timothy Spear
I have created chat app using Gwt, Rpc call to store and retrieve, backend I have used objectify and Google App engine, App link : http://my-health-care.appspot.com/Chat.html , works well and good :)

Thanks,
Suresh
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages