view360_chat 1.0.3
view360_chat: ^1.0.3 copied to clipboard
A Dart package for chat socket connection and messaging API for implimenting view360 chat feature.
view360_chat #
A Flutter package that enables seamless integration of View360 chat functionality through real-time socket connection and messaging APIs. This package is ideal for apps that need a customer chat widget with features like file sharing, message delivery, and live socket-based communication.
๐งฉ Features #
- ๐ Socket connection to View360's chat server.
- ๐ฌ Send customer messages with optional file attachments.
- ๐ฅ Fetch all messages in a chat conversation.
- ๐งพ Built-in support for customer info (name, email, phone).
- ๐ง Easy to configure with your base URL and app ID.
๐ป Full Example #
import 'package:view360_chat/view360_chat.dart';
void main() async {
final socketManager = SocketManager();
socketManager.connect(
baseUrl: 'https://yourdomain.com',
onMessage: (content, files, response) {
print('๐ฉ New message: $content');
},
);
final chatService = ChatService(
baseUrl: 'yourdomain.com',
appId: 'your-app-id',
);
final response = await chatService.sendChatMessage(
chatContent: 'Hello from Flutter!',
chatId: 'abc123',
socketId: socketManager.socket.id!,
customerName: 'John Doe',
customerEmail: 'john@example.com',
customerPhone: '1234567890',
);
final history = await chatService.fetchMessages(customerId: 'abc123');
if (history.success) {
print('๐ฌ Chat History: ${history.messages}');
} else {
print('โ Error: ${history.error}');
}
}