isolating shared environments

30 views
Skip to first unread message

Alexander Tsepkov

unread,
Feb 5, 2017, 6:02:29 AM2/5/17
to ShareJS
Hi, thanks for the library, it solved a lot of my pain points. But now I'm trying to figure out how to deal with the remaining one.

I'm writing an app with multiple rooms, the idea is to keep data in the room private to that room. Inside each room I'm using ShareDB for tasks. With the recommended setup, I effectively end up with the same set of queries/data in each room. I'm trying to figure out how to fix this, my plan is to persist the data in mongodb for each room, while keeping it separate. There is also the issue of privacy, but given that I have control of initialization/connection logic on the server side, I can simply refuse to serve the content for another room.

I'm trying to figure out what my options are and how to best implement this. Here are the options I've been looking at:

1. see if I can use different paths for same mongodb instance, this may be good enough if it's possible to do in Heroku, it may not be.
2. prefix each query with a room id (not a fan of this solution, it also would require me to add a safety check to make sure the query is allowed to be executed from current room)
3. manually load data from mongo when room starts and generate documents myself (would the objects be safe or would they leak into other rooms created at the same time?)

Thanks
Reply all
Reply to author
Forward
0 new messages