@anyaipartner/im-sdk
v2.0.4
Published
Official IM SDK for Comind - A powerful instant messaging solution for web applications
Maintainers
Readme
@anyaipartner/im-sdk
Official IM SDK for Comind - A powerful instant messaging solution for web applications
✨ Features
- 🚀 Full TypeScript Support - Built with TypeScript for better type safety and developer experience
- 💬 Real-time Messaging - WebSocket-based real-time communication with auto-reconnection
- 👥 Group Chat - Full support for group conversations and management
- 📁 File Transfer - Built-in file upload and download capabilities
- 🔔 Event-Driven Architecture - Easy to integrate with flexible event handling
- 💾 Local Storage - IndexedDB-based offline message caching
- 🔄 Message Status Tracking - Track message delivery and read status
- 🎯 Simple API - Clean and intuitive API design
📦 Installation
npm install @anyaipartner/im-sdk🚀 Quick Start
import { createIMSDK, IMEventType, ConversationType } from '@anyaipartner/im-sdk'
// Create SDK instance
const sdk = createIMSDK({
appId: 'your-app-id',
appSecret: 'your-app-secret',
apiBaseUrl: 'https://api.example.com',
wsUrl: 'wss://ws.example.com',
})
// Listen to events
sdk.on(IMEventType.MESSAGE_RECEIVED, (message) => {
console.log('New message:', message)
})
// Login
await sdk.login({
userId: 'user123',
userName: 'John Doe',
})
// Send a message
const message = sdk.message.createTextMessage({
to: 'user456',
conversationType: ConversationType.SINGLE,
payload: { text: 'Hello!' },
})
await sdk.message.sendMessage(message)📖 Documentation
For detailed documentation, please visit GitHub Repository
🌐 Browser Support
| Browser | Version | |---------|---------| | Chrome | >= 90 | | Firefox | >= 88 | | Safari | >= 14 | | Edge | >= 90 |
