I'm wondering how to emit only to clients that are interested in that information. Specifically, let's say all clients are receiving a data feed as it becomes available. But a client can also filter their results, (e.g., searching for a hashtag or a date interval), in which case I'd want only the pertaining results to appear on their side. I suppose I could send all data to all clients, and then have that filtered client-side. But that sounds bandwidth-intensive.
So then I was thinking I could make a room or namespace with an id equivalent to their search string. Then when the data become available server side, I'd test each of the namespace/room names (search terms) against the data and emit it if there is a match. For those clients not filtering their results, they are emitted all data. But then it sounds CPU-intensive to test all client search strings server-side every time new data become available.
Is there a preferable method? (I'm new to sockets. If it matters, I'm using express.io sockets)