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

Auro Stream Chat for iOS/Android/Desktop/Web

AuroStream Chat SDK #

AuroStreamChat is a powerful, real-time chat SDK that allows you to integrate scalable chat functionalities into your app seamlessly. It provides essential chat features like sending/receiving messages, managing chat rooms, handling typing indicators, and much more.

Features #

  • Real-time Messaging: Support for instant messaging with events for sending, receiving, editing, and deleting messages.
  • Room Management: Easily create, delete, join, and leave chat rooms.
  • Typing Indicators: Notify participants when a user starts or stops typing in a room.
  • User Presence: Detect when users join or leave chat rooms.
  • Error Handling: Advanced error management for server connections and operations.
  • Customizable Callbacks: Use callbacks to handle various events such as user joining, leaving, message sending, or errors.
  • Socket-based Architecture: Provides real-time communication using WebSocket technology.

Installation #

Add this to your project's pubspec.yaml file:

dependencies:
  auro_stream_chat: ^0.0.1

Then, run:

dart pub get

Usage #

1. Initialize the SDK #

To use the SDK, you must initialize it with the project details like projectId, apiKey, and port.

import 'package:auro_stream_chat/auro_stream_chat.dart';

void main() {
  AuroStreamChat.initialize(
    projectId: 'your_project_id',
    apiKey: 'your_api_key',
    port: 'your_port',
  );
}

2. Connect to the Chat Server #

Before starting any chat operation, you need to connect to the server.

AuroStreamChat.instance.connectServer(
whenConnect: () {
print('Connected to the server');
},
whenDisconnect: () {
print('Disconnected from the server');
},
whenConnectError: (error) {
print('Connection error: $error');
},
whenReconnect: (data) {
print('Reconnected: $data');
},
whenReconnectError: (error) {
print('Reconnection error: $error');
},
);

3. Sending and Receiving Messages #

You can easily send messages to a specific chat room using the following method:

AuroStreamChat.instance.sendMessage(
roomId: 'room_id',
username: 'user_name',
message: 'Hello, World!',
);

To listen for new messages in a chat room:

AuroStreamChat.instance.onReceiveMessageListener(
whenReceiveMessage: (message) {
print('New message received: $message');
},
);

4. Room Management #

Create a Chat Room

AuroStreamChat.instance.createRoom(roomId: 'room_id');

Join a Room

AuroStreamChat.instance.joinRoom(
roomId: 'room_id',
username: 'user_name',
);

Leave a Room

AuroStreamChat.instance.leaveRoom(
roomId: 'room_id',
username: 'user_name',
);

5. Typing Indicators #

To notify when a user starts typing:

AuroStreamChat.instance.startTyping(
roomId: 'room_id',
username: 'user_name',
);

To notify when a user stops typing:

AuroStreamChat.instance.stopTyping(
roomId: 'room_id',
username: 'user_name',
);

6. Handling Errors #

You can also listen for errors during various operations:

AuroStreamChat.instance.connectServer(
whenGetError: (error) {
print('An error occurred: $error');
},
);

Full API Documentation #

For detailed information on the full API, including all available events and methods, please check out the API documentation.

License #

This package is licensed under the MIT License. See the LICENSE file for more details.

1
likes
130
points
41
downloads

Publisher

verified publisheraurostream.com

Weekly Downloads

Auro Stream Chat for iOS/Android/Desktop/Web

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, pointycastle, socket_io_client

More

Packages that depend on auro_stream_chat