rasel_chatting_sdk 0.1.4 copy "rasel_chatting_sdk: ^0.1.4" to clipboard
rasel_chatting_sdk: ^0.1.4 copied to clipboard

Flutter/Dart client for the Rasel Chatting SDK — REST API, WebSocket chat, groups, media, reactions, search, and push device registration.

rasel_chatting_sdk #

Flutter/Dart client for the Rasel Chatting SDK — a multi-tenant chat-as-a-service platform. Connect your app to the REST API and real-time WebSocket layer for groups, messages, media, reactions, search, and push notifications.

Features #

  • REST client: auth, groups, messages, file upload, profile, reactions, search
  • Real-time chat via ChatSocket (Socket.IO)
  • Message edit/delete with onMessageUpdated listener
  • Emoji reactions (REST + socket)
  • Server-side message search within a conversation
  • Push device registration (registerDevice / unregisterDevice)
  • English and Arabic i18n (ChattingI18n)

Install #

Add to your app's pubspec.yaml:

dependencies:
  rasel_chatting_sdk: ^0.1.4
flutter pub get

Quick start #

import 'package:flutter/widgets.dart';
import 'package:rasel_chatting_sdk/rasel_chatting_sdk.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await ChattingSdk.initialize(
    ChattingSdkConfig(
      sdkKey: 'csk_sdk_…', // from your tenant dashboard
      apiBaseUrl: 'https://api.your-domain.com',
      locale: 'en', // optional — English and Arabic supported
    ),
  );

  runApp(const MyApp());
}

// Recommended: your backend mints a chat JWT after the user signs in.
final session = await ChattingSdk.instance.connectWithAccessToken(chatToken);

final groups = await ChattingSdk.instance.listGroups(session.accessToken);

final socket = ChattingSdk.instance.createChatSocket();
socket.connect(token: session.accessToken, userId: session.user.id);
socket.onMessage((message) => print(message.content));
socket.onMessageUpdated((message) => print('updated: ${message.id}'));
await socket.joinGroup(groups.first.id);

SDK key vs chat login #

Step Credential Purpose
ChattingSdk.initialize SDK key (csk_sdk_…) Binds your app to a tenant workspace
connectWithAccessToken Chat JWT from your backend Attaches session — no chat password on device
login (legacy) Chat user email + password Only if you manage chat passwords yourself

Push notifications #

  1. Obtain a device token from your push provider (e.g. firebase_messaging).
  2. Register it after login:
await ChattingSdk.instance.registerDevice(
  session.accessToken,
  fcmToken,
  platform: 'android', // or ios / web
);
  1. Toggle delivery with updateProfile(..., notificationsEnabled: true/false).
  2. Call unregisterDevice on logout.

The server delivers pushes when FCM_SERVER_KEY is configured on the API.

Server-side session minting #

Never ship your tenant API key in a mobile client. Mint chat sessions on your backend:

// Server-side only (Dart backend or via your own API):
final session = await ChattingSdk.instance.mintChatSession(
  apiKey: tenantApiKey,
  externalId: user.id,
  email: user.email,
  name: user.name,
);
// Return session.accessToken to the mobile app.

More information #

License #

MIT — see LICENSE.

1
likes
0
points
407
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter/Dart client for the Rasel Chatting SDK — REST API, WebSocket chat, groups, media, reactions, search, and push device registration.

Homepage
Repository (GitLab)
View/report issues

Topics

#chat #messaging #websocket #realtime #sdk

License

unknown (license)

Dependencies

http, http_parser, socket_io_client

More

Packages that depend on rasel_chatting_sdk