I'm using sailsjs sockets and I'm trying to find a way to add security to room events.
Basically I have a user collection with a 1-many relationship with a car collection.
I want to have my app listen to the create
event when a user creates a new car, while making sure I'm not leaking create events by other users.
When I use Car.subscribe(req.socket)
with
Car.publishCreate({
id: 3,
color: 'blue',
user: 1
})
all users who are listening to the Car
model room receive updates.
I know that I can specify sockets to omit with a second parameter: Car.publishCreate( values, [socketToOmit] )
, but with many users, this becomes pretty heavyweight.
Is there a simple way to notify/limit "create" events to a specific user in a model room?