Skill

Integrate Matrix SDK with Makepad Apps

Matrix SDK integration patterns for Makepad UI apps: sliding sync, async worker tasks, and timeline updates, from Robrix/Moly.

Works with matrix sdk

81
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Integrate the Matrix SDK into Makepad applications, enabling real-time communication features like sliding sync, timeline subscriptions, and message handling. This skill provides best practices for connecting to Matrix homeservers and managing asynchronous operations within the Makepad UI.

Outcomes

What it gets done

01

Implement Matrix client features (rooms, timelines, messages) in Makepad.

02

Handle Matrix SDK asynchronous operations and UI updates.

03

Utilize sliding sync for efficient room list management.

04

Manage Matrix SDK connections and real-time event subscriptions.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-robius-matrix-integration | bash

Overview

Robius Matrix SDK Integration Skill

A Rust integration guide for wiring the Matrix SDK into Makepad UI apps using sliding sync, an async worker task, and MatrixRequest/TimelineUpdate enums, based on the Robrix and Moly codebases. Use when building or extending a Matrix client on Makepad, implementing rooms/timelines/messages, or handling Matrix SDK async operations from the UI thread.

What it does

Documents best practices for integrating the Matrix SDK (matrix-sdk/matrix-sdk-ui Rust crates) with Makepad UI applications, based on patterns extracted from the Robrix Matrix client and the Moly LLM-integration codebase. It covers four core architectural decisions: native sliding sync for efficient room-list updates, a separate Tokio runtime running Matrix operations while Makepad owns the UI thread, a request/response pattern where the UI submits MatrixRequest enum variants and receives actions or TimelineUpdate/RoomsListUpdate events back, and per-room background timeline-subscriber tasks. It documents the full MatrixRequest enum covering login/logout, timeline pagination, sending/editing/redacting messages, room join/leave, user profile and ignore operations, avatar/media fetching, typing and read receipts, reactions, and subscriptions; the submit pattern for dispatching requests from the UI thread through a global sender; a worker-task handler that matches on each request variant and spawns a dedicated async task per operation; the TimelineUpdate and RoomsListUpdate enums used to push results back to the UI; a per-room subscriber that streams timeline diffs and signals the UI on each update; a Widget::handle_event pattern for draining pending updates on Event::Signal; and a full build_client function showing sliding-sync client construction with SQLite-backed encrypted storage and cross-signing/backup settings.

When to use - and when NOT to

Use it when integrating the Matrix SDK with Makepad, building a Matrix client on Makepad, implementing Matrix features like rooms, timelines, or messages, or handling Matrix SDK async operations from a Makepad UI thread. It is scoped to the architectural pattern demonstrated by Robrix and Moly rather than general Makepad UI work, and does not substitute for environment-specific validation, testing, or expert review of the resulting integration.

Inputs and outputs

Input is a Matrix-client integration task - a request to add or modify a room, timeline, or message feature - within a Makepad application. Output is Rust code following the documented request/response architecture:

static REQUEST_SENDER: Mutex<Option<UnboundedSender<MatrixRequest>>> = Mutex::new(None);

pub fn submit_async_request(req: MatrixRequest) {
    if let Some(sender) = REQUEST_SENDER.lock().unwrap().as_ref() {
        sender.send(req).expect("BUG: matrix worker task receiver died!");
    }
}

plus the corresponding worker-task match arm and UI-side Event::Signal handler that completes the round trip.

Integrations

Built on the matrix-sdk and matrix-sdk-ui Rust crates, Tokio for the async runtime, crossbeam_channel and SegQueue for cross-thread update queues, and Makepad's Cx, SignalToUI, and Widget APIs. Points to three deeper reference files for client setup, timeline handling, and Moly's OpenAI/SSE/MCP multi-provider API integration patterns.

Who it's for

Rust developers building or extending a Matrix chat client on the Makepad UI framework who need the sliding-sync, async-worker, and per-room update architecture already proven in Robrix and Moly.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.