RESTful: bidirectional communication
Asked Answered
I

3

6

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!

Immedicable answered 14/9, 2010 at 7:7 Comment(1)
From what i understand of REST, yes, state is against RESTGrate
U
5

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

Unstrung answered 14/9, 2010 at 7:13 Comment(0)
S
1

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.

Stovall answered 14/9, 2010 at 7:15 Comment(1)
is there a browser supporting web sockets already? I saw that JBoss Netty supports this connection.Immedicable
N
0

You should take a look at BOSH. BOSH is similar to Comet, but more specific, and I think, there are more reliable implementations.

Though, you will have problems serving multiple users at the same time if you want to use a standard REST service. You should think of some other implementation using nonblocking IO.
There are probably more questions about . Of course, there are now too, but if you need to serve old Browsers, you cannot rely on them.

Neo answered 4/2, 2013 at 10:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.