wampautobahncrossbar

WAMP RPC functions with the same name on different devices


I have a program that registers an RPC function, ex. com.myapp.foo. I then run this program on several independent devices, all connected to the same router.

When I start up the second device, it gets an error, because the RPC function has already been registered (wamp.error.procedure_already_exists).

This makes sense, since the router needs a unique name in order to route procedure calls properly. But in my case,

My first thought was that each device should generate a unique procedure name (com.myapp.device4.foo).

I'm working in python/asyncio and javascript, both using autobahn on the crossbar.io server.


Solution

  • Generating a unique name:

    The first variant has the advantage that procedure URLs are persistent and easy to correlate with the device.

    Discovering registered procedures:

    If your clients have permissons to access it, the WAMP meta API allows querying for existing procedures - see http://crossbar.io/docs/Registration-Meta-Events-and-Procedures/

    If your URLs contain the the MAC/device serial/other unique info to the device, then that's all you need to know which devices are currently up.