I think if I needed to accomplish this, I would use a slightly different architecture. I believe the idea of WAMP is to keep the router very generic. That is why we don't have any examples of this.
“All application specific code should reside in WAMP application components, not in the router itself.”
—tobias
That being said, it still would not be too difficult to do what you want to do - but would require intercepting the messages. Ideally, it would be nice to override the Broker - but we don't have a generic way to switch that out right now. So we can override the Router and inspect every message:
class MyRouter extends Router {
public function onMessage(TransportInterface $transport, Message $msg) {
if ($msg instanceof PublishMessage) {
if ($msg->getTopicName() == "mytopic") {
// mangle the message in here
}
}
parent::onMessage($transport, $msg);
}
}
Then just use this class instead of the default Router when you are starting up.
I have not tried this code, if I get a chance I will. The idea should work though.