Closed dylan-mcdougall closed 11 months ago
After reviewing documentation, next step will be to remove the express server from the initial creation of the WebSocketServer in order to enable me to employ user and room authentication as well as initially fulfill the intended use case of having separate webSocket connections between each of the rooms to provide better scalability
Refactored the websocket integration with the server as well as the connection in the frontend. The rendering of messages has been adjusted, need to investigation the interaction between navigating rooms and the expected behavior of closing the previous room and opening the new one.
Additionally need to refactor the deletion of messages to operate on the roomMessages state, incorporate it so that both the designated roomMessage and the database message are targeted for deletion, consider moving roomMessages into a Set for easy deletion, would need to investigate the ability to allow a minimum amount of duplicate messages to go through
With the original implementation of WebSockets, I misunderstood the technology and more used it as a way to quickly send HTTP requests and fetch the message data from the database rather than utilizing the WebSocket for it's intended purpose. There are several separate points that need to be addressed.
Need to refactor both the backend and frontend to properly utilize the wss stream as being the primary source of rendering the messages as they are sent.
Manage the frontend state such that you make a call to the HTTP endpoint responsible for returning the database log of messages ONLY when a user first loads a room.
Alter the wss stream connection on the frontend to just connect the user to the backend whenever they connect to the site, see ticket #38 for more details for how this will be subject to change later.
Investigate and find a solution for how we should be prompting the database to attach images to any messages that are sent, my initial intuition is that our current model might be fine, we can just include an edgecase that if the webSocket data has a content_src then we prompt the database to replace the WebSocket messages as a whole with the database messages. Another potential solution is to create a new endpoint to return the details of a message and we utilize that endpoint to replace individual messages with a new one containing the image data.