views:

37

answers:

2

I was wondering if it is possible to have a RESTful web service and a bidirectional communication with the clients and server.

In my case the state on the server can change, so the server should send a message to the clients to update themself. Perhaps that's totally against the RESTful idea.

Can I AJAX help me with this issue?

Thanks!

+2  A: 

Not really possible under the standard http paradigm, but check out Comet for a possible workaround on that problem and there is alway polling.

Shay Erlichmen
Thanks for the link to Comet
myborobudur
A: 

The functionality you are after is treated by the concept of web sockets, but they are not mainstream yet.

To keep your solution RESTful you can have the clients poll your service. You can optimize any number of ways, like implementing a special method that lets clients query for changes given a timestamp, then the client just keeps track of when it last checked.

Gabriel
is there a browser supporting web sockets already? I saw that JBoss Netty supports this connection.
myborobudur