Recommendations for future work
- Move database handling from client to the server
- Implement sockets between client and server
- Optional: if you want to move from Firebase to a different DB (like MongoDB or MySQL) you'll probably want to implement socket functionality between DB and server, and then between server and client to ensure real time data transfers
- Use Cordova and PhoneGap to render/run the application more efficiently on mobile devices
Right now our server only serves static files. Once the client receives index.html they have full access to the database. This way the client receives real-time updates from db (due to Firebase behind-the-scenes socket functionality).
However that's not very secure and any tech-savy client could easily hack the database this way. So we suggest moving the database handling functionality from the client to the server which will present two challenges:
- The refactor itself - moving all the database functionality to the server
- Preserving the real-time data communication between the database and client through the server
Since Firebase already offers real-time data streams, your server will always be up to date with the database. However the client will have no clue about the updates unless the server also has real-time data stream with the client. So we recommend that you implement sockets between the server and the client
Example flow of data:
- The client's location updates
- The immediatelly notifies the server (via post request)
- The server then updates the database
- Firebase (due to real-time capability) sends the new data back to server
- The server (using sockets) notifies all the clients who are currently logged in, and the map updates in real-time