Archived

This forum has been archived. Please start a new discussion on GitHub.

Repeating callbacks

Is there any way using the AMI/AMD asynchronous calls to make repeated callbacks to a client from the server. I.e. client makes call to server, server sends results back to client in a callback, the server can then call the callback again and again, sending different data to the client?

Cheers

Lance

Comments

  • mes
    mes California
    Hi Lance,

    The first reply that your server sends isn't really a callback, i.e., it's not an invocation from server to client, it's merely a delayed response to the client's original request.

    If your server needs to make invocations on the client, then the client must provide the server with a proxy that the server can use (i.e., the server becomes a client). The server can use synchronous invocations or AMI, just like any other client.

    See the example in demo/Ice/callback for some sample code. Also note that if your server needs to traverse firewalls in order to make callbacks on the client, then you should read about Glacier in the Ice manual.

    Hope that helps,
    - Mark
  • Thanks - I thought I was going to have to do that, I just didn't want to! I just thought that maybe as the server had sent one response back to the client, then possibly it could send multiple responses before the channel got closed.

    Cheers

    Lance
  • marc
    marc Florida
    I'm afraid this is not possible, because it would destroy the call type transparency. I.e., the server doesn't know if it receives an AMI call, and the client doesn't know if the server processes a request as AMD.