PDA

View Full Version : MetaDataAdapter filtering using isSelected()


pwestlake
04-16-2008, 05:20 PM
I would like to filter events based on client criteria. I have implemented a MetaDataAdapter as described in http://www.lightstreamer.com/vb/showthread.php?t=65&highlight=isSelected

This works. However there is only one MetaDataAdapter per lightstreamer adapter. So the same filter criteria is used for each client that has subscribed. I am new to lightstreamer so I think I am missing something, but how do I configure this so that for example: client 1 only receives events for changes to account 1 and client 2 only receives events for changes to account 2?

The isSelected() method of the MetaDataAdapter has a user parameter, but this is always null!

Thanks,

Phil

Mone
04-17-2008, 10:23 AM
to get a value on the user parameter of the isSelected method you have to set a user name (and a password if needed) on the client side. In example, if you're using the javascript client you can call the setUserName (http://www.lightstreamer.com/docs/client_web_jsdoc/Connection.html#setUserName) method of the Connection (http://www.lightstreamer.com/docs/client_web_jsdoc/Connection.html) instance of your LightstreamerEngine (http://www.lightstreamer.com/docs/client_web_jsdoc/LightstreamerEngine.html) instance obtained through the onEngineCreation (http://www.lightstreamer.com/docs/client_web_jsdoc/PushPage.html#onEngineCreation) callback:
var lsPage = new PushPage();
[...]
lsPage.onEngineCreation = function(lsEngine) {
lsEngine.connection.setUserName("userName");
[...]
};


Btw note that maybe in your case it could be better if you use two different items instead of using a single item to be filtered.
see http://www.lightstreamer.com/vb/showthread.php?t=61

pwestlake
04-21-2008, 02:39 PM
Thanks,

My issue was actually fixed by resolving a threading issue in my code.