Client proxy creation

MurthybhatMurthybhat Member Shankarmurthy bhatOrganization: BOSCHProject: Publish field data to multiple browser clients
Hello,

we have an application where multiple Ice clients interacts with Ice server. Client provides a callback functionality which is defined in the slice file. Clients register with unique ids to the server. Server is separated into further 2 ice layers. Server top layer has to pass the client information(id) to the lower layer. The lower layer invokes the callback on each client.


We tried creating adapter with fixed Id on client side and invoke callback from lower layer of server. Below is the code snipet we used to create proxy on lower layer of server,
CallbackSenderI::addClient(const Identity& ident, const Current& current)
{
CallbackReceiverPrx client = CallbackReceiverPrx::uncheckedCast(current.con->createProxy(ident));
}


we are unable to call the callback, could someone help with how to create client proxy?

Thanks,
Murthy

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Murthy,

    Can you describe a little more how these 2 Ice layers are implemented? Does each layer have its own communicator or object adapter?

    You must make sure to create the proxy using the Ice connection object that represents the connection with the client.

    If the upper layer calls into the lower layer with an Ice remote invocation, the lower layer Ice connection object obtained from Ice::Current won't be the connection to the client but the connection to the upper layer... so the proxy created with this connection won't point to the client, it will point to the upper layer... Could this be the issue?

    Cheers,
    Benoit.
  • MurthybhatMurthybhat Member Shankarmurthy bhatOrganization: BOSCHProject: Publish field data to multiple browser clients
    Thanks Benoit,

    Both layers of Ice server has it's own communicator and object adapter. There is separate connection between these two layers. Issue is the different connection object as you mentioned. Could you help how can we solve this or how do we get client connection object at lower layer ?

    Thanks,
    Murthy
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Ice connection objects are "local objects" which can't be passed over the wire. So the Ice connection object that belongs to the Ice communicator from the upper layer can't be passed to the lower layer through an Ice remote call.

    I'm curious, what is the intent of the 2 layers and why do they communicate through Ice remote calls if they are in the same process? Are you eventually planning to have these 2 layers running in their own process?

    Bi-directional connections work well when dealing only with a client and a server. In your situation, it's as if you had 3 peers: the client, an middle-tier (upper layer) and a backend (lower layer). In such a scenario, the client establishes a connection only with the middle-tier and can therefore only receive bi-dir callbacks from the middle-tier. To receive callbacks from the backend, the backend would need to send the callback to the middle-tier which would then have to forward it to the client. Implementing this is possible but it's not trivial.

    Another option is to use Glacier2. With Glacier2, the backend servers don't need to worry about creating bi-dir proxies, they can just use the callback proxies provided by the client. Invocation on these proxies are automatically routed through Glacier2 back to the client.
  • MurthybhatMurthybhat Member Shankarmurthy bhatOrganization: BOSCHProject: Publish field data to multiple browser clients
    Thanks again Benoit,

    Two layers run on different process hence we cannot use same communicator nor adapter. We now plan to create separate connection between client and backend.

    A quick question: We have currently implemented the javascript client using the bidirectional connection. Is it possible to change bidirectional connection to a separate connection (implementing adapter at the client side).

    Thanks,
    Murthy
Sign In or Register to comment.