dnotifier 1.0.0 copy "dnotifier: ^1.0.0" to clipboard
dnotifier: ^1.0.0 copied to clipboard

Real-time notification and messaging SDK for Dart and Flutter. WebSocket & HTTP, auth, binary frames, and optional OpenAI integration. Supports Android, iOS, and other platforms.

DNotifier Dart SDK #

DNotifier is a real-time notification & messaging SDK for Dart and Flutter, supporting Android and iOS. It provides WebSocket and HTTP transports, binary streaming, and framed packet communication.


Features #

  • WebSocket & HTTP transport support
  • Secure authentication handshake
  • Real-time messaging (send/receive text and binary)
  • Binary data transfer (files, images, media)
  • Automatic packet framing & decoding
  • Handles partial packets & large payloads
  • OpenAI integration (sendWithOpenAI)
  • Works on Android, iOS, and other Dart/Flutter platforms

Installation #

Add to your pubspec.yaml:

dependencies:
  dnotifier:
    path: .  # or git: https://github.com/...

Or publish the package and use:

dependencies:
  dnotifier: ^1.0.0

Then run:

dart pub get
# or
flutter pub get

Usage #

import 'package:dnotifier/dnotifier.dart';

void main() async {
  final client = DNotifier(
    appId: 'your-app-id',
    secret: 'your-app-secret',
    transport: 'ws',
    userId: 'user-123',
    onConnected: () => print('Connected'),
    onMessage: (DNotifierMessage msg) {
      print('Message from ${msg.metadata.sender}: ${msg.payload.toJSON()}');
    },
    onDisconnected: ({code, reason}) => print('Disconnected: $reason'),
  );

  await client.connect();

  // Send a text message
  client.send(
    senderId: 'user-123',
    receiverId: 'user-456',
    data: {'text': 'Hello'},
  );

  // Send binary
  client.sendBinary(
    senderId: 'user-123',
    receiverIds: ['user-456'],
    buffer: [0x00, 0x01, 0x02],
  );

  // Optional: send with OpenAI and get streamed response
  // await client.sendWithOpenAI(
  //   senderId: 'user-123',
  //   message: 'Hello',
  //   openaiApiKey: 'sk-...',
  // );
}

API summary #

Method / property Description
DNotifier(appId, secret, transport, userId, ...) Build the client. transport is 'ws' or 'http'.
connect() Authenticate and connect (WebSocket handshake when using ws).
send(senderId, receiverId/receiverIds, data) Send a text message (JSON-serializable data).
sendBinary(senderId, receiverIds, buffer, type?) Send raw bytes.
sendWithOpenAI(senderId, message, openaiApiKey, model?, baseUrl?) Call OpenAI chat and deliver the result via onMessage.
disconnect() Close the WebSocket.
onConnected Callback when connection is ready.
onMessage Callback with DNotifierMessage (metadata + Payload).
onDisconnected Callback when connection closes.
Payload.raw(), .toString(), .toJSON(), .toBase64() Read received payload.

0
likes
0
points
126
downloads

Publisher

unverified uploader

Weekly Downloads

Real-time notification and messaging SDK for Dart and Flutter. WebSocket & HTTP, auth, binary frames, and optional OpenAI integration. Supports Android, iOS, and other platforms.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

http, web_socket_channel

More

Packages that depend on dnotifier