Redis Pub/Sub with kind of join

Say we have the main code base in ASP.NET and the main DB in MSSQL

We want to add some realtime functionality - there's a source of events, each related to some user. The users have the 1-to-many relationship (friendship). Each event related to specific user should be published to each of her friends (that are listening).

Redis and Node.js+Socket.IO are considered as (probably the most powerful and best-suiting) solution. So, when an event occurs ASP.NET would publish to Redis and Node.js will subscribe and forward to browsers through Socket.IO.

Now the question - at which point should the filtering logic occur to only send the event to the user's friends?

We can have these data stored in Node.js in memory, but is it effective? We could regularly export the relationship data to Redis, but can it be used together with Pub/Sub through some scripting on Redis side?