I am trying to implement a chat server on the amazon EC2 cloud for a university project.I have decided to use callbacks on the client end using the observer pattern I initially thought of using RMI but it was an absolute pain to get working on EC2 with callbacks, and i would be limited to using java clients.
So i switched to JAX-WS so that i could use SOAP on a given client, but i can only seem to send messages to the server and get data back when the client requests it rather than the sever update observers when data has been changed (e.g. the client sends a message to the chatroom)
So i thought i would ask, does anyone know what would be a good solution to my problem?
I need to be able to make callbacks from the server to the client and not be limited to Java clients.
Is this possible?
Any help would be great, even if it is only to tell me i NEED to use RMI
Tried looking at some examples of REST. I cant really see how REST can perform an RPC on the client side though?
Do you know where there is any tutorials etc... as i cant seem to find any
You have to understand that REST is simply about messages. You use normal HTTP communications, and send Strings back and forth. So normal HTTP rules apply.
This is great, because HTTP is allowed though all known firewalls, and RMI is nearly impossible to get "allowed" though any corporate firewalls.
You need to simply design around messages.
One might be for the client to issue a GET for "characters typed by other user" and you can POST characters typed by the specific client on their computer.
There is no need to poll for characters available, just have a loop, that GETs the characters. It will get what is available, and then issue the next GET. If there is nothing to send, the GET can wait.
You probably want to have the HTTP client code in a separate thread, so you can decide that you are tired of waiting on the GET.