Archived

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

Using bidirectional connections with Murmur

Hi again,

I'm attempting to use the Ice interface exposed by Murmur (Mumble), specifically the callback mechanism, but I'm a little confused on how to set up a bidirectional connection.

I've been looking at Bidirectional Connections - Ice 3.5 - ZeroC for an explanation on how to set up the connection, but it looks like Murmur isn't following the same pattern where the client passes a unique identity to the server. Instead, Murmur automatically creates a proxy and an identity (based on the server ID) when the Server object is created by the client:
static void impl_Meta_newServer(const ::Murmur::AMD_Meta_newServerPtr cb, const Ice::ObjectAdapterPtr adapter) {
	cb->ice_response(idToProxy(ServerDB::addServer(), adapter));
}

static ServerPrx idToProxy(int id, const Ice::ObjectAdapterPtr &adapter) {
	Ice::Identity ident;
	ident.category = "s";
	ident.name = u8(QString::number(id));

	return ServerPrx::uncheckedCast(adapter->createProxy(ident));
}
ServerPrx exposes a method called setAuthenticator() (Murmur::Server), which allows the client to set a callback proxy. However, I'm a little unclear how I apply that to the bidirectional connection example that I linked above.

For instance, ServerPrx exposes several types of callbacks, such as ServerAuthenticator and ServerContextCallback, but if the server only creates a single identity for the ServerPrx when it's created, how do I add multiple callback objects on the client side since ObjectAdapter::add() only allows unique identities.

Comments

  • bernard
    bernard Jupiter, FL
    Hi Soren,

    With bi-directional connections, the client establishes a connection to the server, and later the server uses this connection to send request to objects (typically callbacks) hosted by the client.

    This requires special coding on both the client side and server side. If the Murmur server does not provide support for bi-directional connections, you won't be able make it use your client-to-server-connection for callbacks.

    A solution here could be to use Glacier2 between your client and server. For the server, the Glacier2 router will look like a regular client on the same LAN (without bi-directional connections). Connections between your clients and the Glacier2 router would be bi-directional, without any special coding.

    Best regards,
    Bernard
  • Hi bernard,

    Thanks for the response. Based on what I can tell from the Murmur source code, it doesn't look like they've built their Ice interface with bidirectional connections in mind.

    Let's say I wanted to skip Glacier2 and bidirectional connections altogether. What would I do on the client side to register a callback with the Murmur server? I know I need to pass a proxy object to setAuthenticator(), but I'm unclear on how that proxy is created and set up on the client side.
  • bernard
    bernard Jupiter, FL
    Hi Soren,

    You create this proxy in your client like you would create a proxy in a server, by calling add() or createProxy() on an object adapter in your client (which is also a server as a result).

    Best regards,
    Bernard
  • Thanks bernard. I already have glacier2 working at this point, so all is good. Thanks. :)