You might also want to check out this old post, which contains some code:
https://forums.lightstreamer.com/showthread.php?65-Using-selectors