Pregunta

I know that the intended use case of a Pub/Sub pattern is to let the clients "multicast" directly to each other with the servers work transparent. But there has been a few occasions where I'd like my server to react a clients publish. Basically I'd like a server.Subscribe('event:ident', callback). Before starting to implement this, I guess I'm not the first running in to this limitation. How do you folks solve it?

In this latest case I'd like to measure the latency between two clients. So I let first client publish a message which the other client subscribe to will respond to ASAP. Obviuosly the traffic will pass through the server. So I'd like the server to also respond so I can separate the latency from the first client to the server from the latency from the server to the second client.

Do you see any pitfalls with this approach? (Except that I'm breaking the strict PubSub pattern)

Note that I'm using the WAMP.IO lib (implementing the WAMP-protocol). I'm not talking about Windows, Apache, PHP and MySQL server!

¿Fue útil?

Solución

For WAMPv1, an (ugly) solution is to break the PubSub pattern and have the client publish the message as an RPC, where then server then publishes a PubSub message.

In WAMPv2 (under development), a server will also be able to subscribe to topics.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top