Open shinobiseb opened 3 days ago
Sockets and refetch function work however client side "socket.onmessage" is only being fired when a user sends a message
The intended function is for whenever a refetch message is sent via websocket, the client will fetchMessagesFromChat.
Need to refactor logic within server likely
Also, need to find a way to implement watch.ts still (watchMessages()) for better performance likely
Key Concepts for Real-Time Chat Updates
WebSocket Communication
Setting Up a WebSocket Server
Database Change Tracking
watchMessages
function) to monitor changes to your chat documents. When a new message is added or an existing message is updated, the Change Stream will trigger an event.Client-Side WebSocket Connection
Handling Incoming Messages
Sending Messages