I am making more and more steps with using WAMP, Autobahn and Crossbar.io Router in my particular Application. One of the requirements of this Application is to distinguish individual clients from other and allowing 1:1 communications.
To make this possible I came up with the idea of using the topics to address clients / connected sessions. After some prototyping I found a topic pattern that best works for my application. Here it is:
Let me give you some details on each of the patterns parts:
This is the reversed domain name style like advised in the documentation. So nothing special.
My Application has customers. Each customer should be addressable so I came up with assigning a UUID for each customer and make this ID part of the Topic-String.
The Customers of my Application can create Device-Types with user defined names, commands, properties, etc. Each Type has an UUID and this ID is part of the Topic-String. With this information embedded into the Topic I can separate and authorize different Device-Types from each other, allowing Sub-Application listen to types of devices only.
A newly connected device is using a Device-Type-Token or ID to submit its type. A new device is being registered and again an UUID is created. This ID addresses the unique device of given type and customer. This way I can address single devices and allow 1:1 communications.
Everything before .command can be seen as some kind of prefix to the actual command / topic which is only used for addressing / distinguishing of the devices. The command can be something like Status, Message, Start, Stop and can lead to RPCs / subscription, etc.
In a real life example the above pattern would lead to the following topic:
Starting with the reversed domain name, the topic can easily separated by customer, type and device + command. This way the WAM-Protocol is working like a charm for my particular application. I am however a bit afraid that topic is too long but I haven’ yet experienced any issues.
Anyway the fact that I can use dynamic authenticators, authorizers is such a good thing. I really begin to love the WAMP protocol and prefer it in so many ways.
I just wanted to share this with you and get some feedback on this.