views:

1631

answers:

2

I'm trying to create a logger for a GWT application as an exercise to evaluate GWT. What I specifically want to do is have it so that I can post messages to a client side label at any point from the server side. So, if some interesting stuff has happened on the server the client can be updated.

My First question is, is this possible, I can understand it not being.

Second, if it is possible, where should I look for information, I've tried google and their documentation and all the showcases have nothing on this.

Thanks

+7  A: 

Well, there are a couple of Options. You need to get the data from the server... So you either need to poll the server, or use server push.

Polling is pretty easy. Just use the Timer class to repeatedly call a service to see what value it should be displaying.

Server push is done using something like comet. here is one implementation for gwt that looks somewhat promising. They basic concept behind this is the browser sends a request to the server and keeps the connection open so the server is free to keep sending data back.

Comet is the better option if you can get it working. It will probably be simpler and scale better.

Good Luck!

Steve g
+1  A: 

Polling is probably the best way to do what you're looking for. The big gotcha with GWT is that everything has to be serializable. I'm not sure if anything that can push to the browser can be easily serialized.

sobedai
If its for logging, the thing getting pushed from the server would be a string of sorts i guess
Chii