Let's say I have 3 clients: Client A, Client B and Client C.
They all support Ping() function, which they register using reflection (code based on WampSharp documentation):
public interface IArgumentsService
{
[WampProcedure("com.arguments.ping")]
void Ping();
}
public class ArgumentsService : IArgumentsService
{
public void Ping()
{
}
}
IArgumentsService services = channel.RealmProxy.Services;
ArgumentService callee = new ArgumentService(this);
services.RegisterCallee(callee);
Next I set up a proxy on each client to make outbound calls:
DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();
IWampChannel channel = channelFactory.CreateJsonChannel("ws://127.0.0.1:8080/", "realm1");
Task channelOpenTask = channel.Open();
channelOpenTask.Wait();
IArgumentsService proxy = channel.RealmProxy.Services.GetCalleeProxy<IArgumentsService>();
How would I go about sending a message from Client A to Client C? I don't see a way to address a specific client when sending a message to router via proxy? All I can do is the following:
proxy.Ping();
I'm guessing that will broadcast a message to all the clients? How can I specify a single client only? Is that use scenario even supported?
According to the WAMP basic profile spec, it is not possible to register the same procedure more than once per a router's realm. The following code will result with an exception on registration (wamp.error.procedure_already_exists). In order to achieve something like you want, consider registering a different procedure uri per client. This can be achieved using ICalleeRegistrationInterceptor.