Objective:
Integrate the Matrix widget API within the useTopics function (or relevant module) to listen for and handle room messages. Set up a structure to forward these messages to the backend when ready.
Tasks
Install and Configure Matrix Widget SDK
Install the Matrix widget SDK to enable Matrix-specific functionality.
Command: npm install matrix-widget-api or yarn add matrix-widget-api
Set up the SDK and configure it to listen for widget events within the room context.
Initialize Matrix Widget API and Handle Events
Initialize the widget API and set up listeners for room messages.
Add an event listener for room.message events to capture new messages in real time.
Extract relevant data from each message (e.g., sender, content, timestamp).
Implement Mock Backend Forwarding
Structure the event handler to forward captured messages to the backend, using mock data for now.
Prepare a function (sendMessageToBackend) to structure the request and format it for backend integration.
Objective:
Integrate the Matrix widget API within the
useTopics
function (or relevant module) to listen for and handle room messages. Set up a structure to forward these messages to the backend when ready.Tasks
Install and Configure Matrix Widget SDK
npm install matrix-widget-api
oryarn add matrix-widget-api
Initialize Matrix Widget API and Handle Events
room.message
events to capture new messages in real time.sender
,content
,timestamp
).Implement Mock Backend Forwarding
sendMessageToBackend
) to structure the request and format it for backend integration.Handle Message Forwarding (Future Backend Integration)
sendMessageToBackend(mockMessagePayload)
for now.Example Code Snippet
Acceptance Criteria
room.message
events.