I am working on a real time collaborative canvas project and in this project users can create rooms and others can join them with some id and pass. my application also support multiple tabs feature and i am also using fabric.js to handle canvas operations now i want to make this application in such a way that if a user gets disconnected from the room due to some internet issue then after reconnecting he can continue from there where he left. For this i need to store data somewhere, i tried to do it with mongoDB but my canvas data is large like 300mb or 500mb and it is taking too much time to fetch it from mongoDB hence the application's performance is very poor. Every operation like undo, open new tab etc all are slow. so, i want to know how should i manage data in this case.
Here is my fabric.js object:
"{\"version\":\"2.4.4\",\"objects\":[{\"type\":\"path\",\"version\":\"2.4.4\",\"originX\":\"left\",\"originY\":\"top\",\"left\":94,\"top\":89.17157287525382,\"width\":4,\"height\":23.83,\"fill\":null,\"stroke\":\"black\",\"strokeWidth\":2,\"strokeDashArray\":null,\"strokeLineCap\":\"round\",\"strokeDashOffset\":0,\"strokeLineJoin\":\"round\",\"strokeMiterLimit\":10,\"scaleX\":1,\"scaleY\":1,\"angle\":0,\"flipX\":false,\"flipY\":false,\"opacity\":1,\"shadow\":null,\"visible\":true,\"clipTo\":null,\"backgroundColor\":\"\",\"fillRule\":\"nonzero\",\"paintFirst\":\"fill\",\"globalCompositeOperation\":\"source-over\",\"transformMatrix\":null,\"skewX\":0,\"skewY\":0,\"path\":[[\"M\",97.998,100],[\"Q\",98,100,98.5,100],[\"Q\",99,100,99,99],[\"Q\",99,98,99,97],[\"Q\",99,96,99,95],[\"Q\",99,94,99,93],[\"Q\",99,92,99,91.5],[\"Q\",99,91,99,90.5],[\"Q\",99,90,98.5,91],[\"Q\",98,92,98,93.5],[\"Q\",98,95,98,97],[\"Q\",98,99,97.5,100.5],[\"Q\",97,102,97,104.5],[\"Q\",97,107,97,108.5],[\"Q\",97,110,96.5,111],[\"Q\",96,112,96,112.5],[\"Q\",96,113,95.5,113],[\"Q\",95,113,95,113.5],[\"L\",95,114.002]]}]}"
This is only one object showing the current state, like this i have many of them in my DB to store previous state as well. because this is real time application i want to minimise the delay so i need faster way.
I am using nodeJs and socket.io.
Thanks