Gravity Server push - Need data to be pushed to client where request has been made

120 views Asked by At

I have the gravity server push working, but it is pushing data to all the clients.

My scenario is flex client is subscribing to a server topic and when it sends a request to the server it waits for server to push the data back.

Right now since there is only one topic on server it is sending data back to all the clients since they all subscribe to the same topic.

Is there is way to configure gravity so that the data is pushed only to specific client from where the request has been made?

Thanks

1

There are 1 answers

0
Olivier J. On

You have to use selector property of your GDS consumer object.

var consumer:Consumer = new Consumer();
consumer.destination = "quotes";
consumer.selector = "id='hereIdOfTheConsumerLogged'";

and send message from your java server for example like that :

myMessage.setStringProperty("id", "hereIdOfTheConsumerLogged");

If "hereIdOfTheConsumerLogged" equals "10", only user with id=10 for selector will receive message.