We are trying to build a Chat app with a Dreamfactory DSP.
We’re betting on Dreamfactory as being a smarter alternative to building our own Rest API from scratch for the umpteenth time, and I have not hesitated in signing up for a paid support plan.
The Project
We are experimenting with frameworks/libraries like Faye to handle the realtime API for the chat service itself.
The realtime API will be mirrored by a REST API for things like chat history / user data. For example, if user ‘john’ writes a message in chatroom ‘lobby’ then we want to emit that message to all other subscribers to the chatroom but also create a new ‘message’ item in dreamfactory, so if a new subscriber joins ‘lobby’ then he can just GET ‘room/lobby’ (which will contain meta about the chatroom and the related messages) and start listening from there.
(is this a plausible/sensible approach or pattern?)
Problems
Our main hurdles are related to:
- Pub/Sub Access Control / Permissions / Security
- Socket/Session caching
We are unsure of how to best implement a Chat service that queries a Dreamfactory DSP to control publish/subscribe permissions. Has anyone had any experience in this area or can advise?
Why (Redis)?
- We are worried that SQL/NoSQL ‘Databases’ are too slow for highly transactional chat logic. Example: user ‘Mila’ has been invited to chatroom ‘Hollywood’ but user ‘Floyd’ has not been invited. ‘Floyd’ tries to listen in on the channel ‘Hollywood’. The Faye server checks the DSP model for the right permissions before allowing Floyd to listen.
- We want to support multiple simultaneous socket connections at scale so need(?) to implement a session cache using something like Redis?** We have discovered that Dreamfactory has (undocumented) Redis support. Would that be best used for chat session cache?
I would massively appreciate a conversation with someone with related experience who could advise on architecting and/or implementing the application.