0.0.1
ART Adk Flutter
A Flutter SDK for ARealtimeTech (ART) — a real-time messaging platform offering WebSocket-based channels, presence tracking, encrypted communication, shared object channels, and AI orchestration integration.
Features
- WebSocket Connection Management — connect, reconnect, and disconnect with built-in reliability
- Channel Subscription — subscribe to broadcast, targeted, group, encrypted, and shared object channels
- Push Messages — send structured payloads to channels with optional targeted delivery
- Listen & Bind — capture all events with
listen()or react to specific event types withbind() - User Presence — track online/offline status of users in real time
- Encrypted Channels — end-to-end encrypted messaging using cryptographic keys
- AI Orchestration — route messages through AI-driven workflows for intelligent responses
- Interceptors — preprocess or post-process messages with custom logic
- Shared Object Channels — CRDT-backed collaborative data structures
Installation
Add this to your pubspec.yaml:
dependencies:
art_adk: ^0.0.1
Then run:
flutter pub get
Getting Started
1. Load credentials
See example/lib/auth/app_auth_config.dart for how to load credentials from an asset file.
2. Initialize the SDK
import 'package:art_adk/art_adk.dart';
final credentials = await AppConfigLoader.loadCredentials();
final adk = Adk(
adkConfig: AdkConfig(
uri: 'your-tenant.arealtimetech.com',
getCredentials: () => credentials,
),
);
await adk.connect();
### 1. Generate Client Credentials
Log in to the [ART Live Dashboard](https://dev.arealtimetech.com) and generate your client credentials. You'll receive a JSON like:
```json
{
"Client-ID": "xxxxxxxxxx",
"Client-Secret": "xxxxxxxxxxx",
"Org-Title": "YOUR_ORG",
"ProjectKey": "YOUR_PROJECT_KEY",
"Environment": "YOUR_ENV_NAME"
}
⚠️ Never commit your credentials to version control.
2. Generate a Passcode
Use the ART REST API to generate an authentication passcode before connecting.
3. Initialize and Connect
import 'package:art_adk/art_adk.dart';
final instance = Adk(adkConfig: config);
adk = instance;
adk.connect();
4. Subscribe to a Channel
final subscription = adk.subscribe('your-channel-name');
5. Push a Message
await subscription.push(
'message',
{'content': 'Hello from Flutter!'},
to: ['username1', 'username2'], // optional targeted delivery
);
6. Listen to All Events
subscription.listen((data) {
debugPrint('Received: $data');
});
7. Bind to a Specific Event
await subscription.push(
event: 'message',
data: <String, dynamic>{'message': text},
options: PushConfig(to: <String>[toUser]),
);
User Presence
final presenceList = await subscription.fetchPresence();
for (final user in presenceList) {
debugPrint('${user.username} is ${user.status}');
}
Connection Events
adk.on(() => debugPrint('Connected'));
adk.onClose(() => debugPrint('Disconnected'));
Encrypted Channels
final secureChannel = adk.subscribe('secure-channel');
final encrypted = secureChannel.encrypt({'secret': 'data'});
final decrypted = secureChannel.decrypt(encrypted);
Interceptors
adk.intercept('message', (event) {
// Transform or validate before processing
debugPrint('Intercepted: $event');
});
Documentation
Full documentation is available at docs.arealtimetech.com/docs/adk.
| Topic | Link |
|---|---|
| Overview | ADK Overview |
| Publish & Subscribe | Pub/Sub Docs |
| User Presence | Presence Docs |
| Encrypted Channels | Encryption Docs |
| Shared Object Channels | Shared Object Docs |
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
MIT License. See LICENSE for details.