sayance-matrix-native-module
v1.4.16
Published
Native Matrix client module for Expo using Rust SDK
Downloads
153
Maintainers
Readme
Sayance Matrix Native Module
A high-performance native Matrix client module for Expo apps, powered by the Matrix Rust SDK.
Features
- 🦀 Rust-powered: Built on the official Matrix Rust SDK for maximum performance
- 🔐 End-to-end encryption: Full E2EE support with Olm/Megolm
- 📱 Cross-platform: Works on iOS and Android via Expo
- ⚡ Native performance: Direct FFI bindings to Rust without JS bridge overhead
- 🔄 Real-time sync: Efficient Matrix sync with event callbacks
Installation
npm install sayance-matrix-native-moduleUsage
import MatrixClient from 'sayance-matrix-native-module';
// Initialize the client
await MatrixClient.initializeClient({
baseUrl: 'https://matrix.org',
accessToken: 'your-access-token',
userId: '@user:matrix.org',
deviceId: 'device-id'
});
// Start syncing
await MatrixClient.startSync();
// Listen for sync updates
MatrixClient.onSyncUpdate((state) => {
console.log('Sync state:', state);
});
// Send a message
await MatrixClient.sendMessage({
roomId: '!roomId:matrix.org',
body: 'Hello, Matrix!'
});
// Get joined rooms
const rooms = await MatrixClient.getJoinedRooms();API Reference
Methods
initializeClient(config)- Initialize Matrix clientstartSync()- Start Matrix syncstopSync()- Stop Matrix syncsendMessage({ roomId, body })- Send text messagegetJoinedRooms()- Get list of joined rooms
Events
onSyncUpdate(callback)- Listen for sync state changes
Development
This module uses:
- Rust: Matrix Rust SDK with FFI exports
- Android: Kotlin JNI bindings
- iOS: Swift FFI bindings
- TypeScript: Expo module interface
License
MIT
