How to Build a Multi-language Instant Messaging Social System | Voice and Video Calls with UniApp and Open-source PHP Backend

After years of application development, the question I get asked most often by clients is: “Can we build our own chat system?” Overseas there is WhatsApp and Telegram, and domestically there is WeChat, but when it comes to deploying a truly private instant messaging system on your own platform, the options are surprisingly limited — either too expensive, not open-source, or built on outdated technology stacks. I recently worked with this multi-language instant messaging system featuring a UniApp front end, Vue-based PC admin panel, and fully open-source PHP API. After actually running it in production, the functionality was far more complete than I expected. Here I am sharing the deployment process and lessons learned.

多语言即时通讯系统界面

1. Core System Features Explained

The biggest advantage of this system is “full platform coverage plus full language support.” The main functional modules include:

  1. Instant Private Messaging (IM): Supports text, images, voice messages, and emoji. Real-time message delivery receipts with persistent server-side history storage
  2. Voice Calling: WebRTC-based one-to-one voice calls with latency controlled under 150ms, with call recording support
  3. Video Calling: 720P/1080P video calls with virtual background and beauty filter support (requires GPU-accelerated server or third-party SDK integration)
  4. Group Chat: Create groups of up to 500 members, with group announcements, @mentions, muting, and admin configuration
  5. Moments / Social Feed: Similar to WeChat Moments — supports text and image posts, likes, comments, and privacy controls
  6. Multi-language Interface: Built-in language packs for 10+ languages including Chinese, English, Japanese, Korean, Arabic, and Spanish, with customizable text strings in the admin panel
  7. User System: Phone number and email registration and login, third-party OAuth (Google and Apple sign-in), with reserved identity verification interface
  8. Admin Panel: Vue-powered PC management interface for viewing user lists, message statistics, ban management, and content moderation
  9. Push Notifications: Firebase and APNs integration for message push alerts when the app is offline
社交聊天系统展示

2. Pre-deployment Checklist

Prepare the following items before starting deployment to avoid wasting time on avoidable issues:

  • Server Specs: Minimum 4 CPU cores and 8GB RAM; 8 cores and 16GB recommended (voice and video are resource-intensive). Start with 10Mbps bandwidth; high-concurrency scenarios call for 20Mbps+
  • Operating System: Ubuntu 20.04 LTS or Cent OS 7/8; Ubuntu recommended for more active package updates
  • PHP Environment: PHP 7.4+, with curl, mbstring, redis, and swoole extensions enabled
  • Database: My SQL 5.7+ or 8.0, plus Redis 5.0+ for message queuing and online status caching
  • Domain and SSL: Web RTC voice and video calls require HTTPS; a free Let’s Encrypt certificate works fine
  • Signaling Server: Web RTC requires a STUN/TURN server — you can self-host with the open-source coturn, or purchase a commercial signaling service
  • Push Services: Register a Firebase project in advance to obtain the server key; iOS push requires an Apple developer account
  • Uni App Development Environment: H Builder X plus We Chat Developer Tools (if publishing as a We Chat Mini Program)
  • Node.js: Building the Vue admin panel requires Node 14+
语音视频通话功能

3. Common Issues and Pitfalls

3.1 Web RTC Video Call Connection Failures

This is the highest-frequency problem when deploying voice and video features. The root cause is almost always a misconfigured TURN server. Key items to check in the coturn configuration file:

listening-port=3478
tls-listening-port=5349
external-ip=YOUR_SERVER_PUBLIC_IP
realm=yourdomain.com
lt-cred-mech
fingerprint

If your server is hosted on Alibaba Cloud or Tencent Cloud, you also need to open UDP ports 49152–65535 in the security group. That single issue cost me most of a day to track down.

3.2 Web Socket Long Connection Drops

When using Nginx as a reverse proxy, the default proxy_read_timeout of 60 seconds causes IM long connections to drop frequently. Add the following to your Nginx configuration:

proxy_read_timeout 3600;
proxy_send_timeout 3600;
proxy_http_version 1.1;
proxy_set_header Upgrade ;
proxy_set_header Connection "upgrade";

3.3 High Group Message Latency

When broadcasting messages to 500-member groups, noticeable delay appeared. Investigation revealed that Redis persistence was disabled, causing message queue buildup. Enabling AOF persistence and increasing the consumer process count from 1 to 4 resolved the issue.

3.4 iOS Push Notifications Not Received After Uni App Build

Check whether the Bundle ID in the plist file exactly matches the configuration in the Apple Developer Console (including capitalization). Also note that APNs has separate development and production certificates — use the dev certificate for test devices, and switch to the production certificate before App Store release.

IM系统后台管理

4. Customization and Extension Options

Using this system as a foundation framework, the following extensions are most frequently requested by clients:

  • Live Streaming: Build on the existing Web RTC foundation and integrate RTMP streaming to enable live broadcasting with real-time interactive comments
  • Paid Membership: Add membership tiers to the user system — unlock HD video, expanded group limits, and other features based on subscription level
  • Enterprise IM: Add organizational structures, approval workflows, work groups, and file auditing for enterprise communication needs
  • AI Customer Service Integration: Integrate AI tools such as Chat GPT or Kimi at chat entry points for automated initial responses and user routing
  • Multi-platform Sync: Currently supports mobile and PC; can be extended with a web client so users can chat directly in a browser without installing an app
UniApp前端界面

Security Notice: When self-hosting an instant messaging system, pay close attention to message encryption (end-to-end encryption is strongly recommended), compliance requirements for local user data storage, and integration with content moderation APIs (such as Alibaba Cloud Green or Tencent Cloud Tianyu) to prevent the spread of prohibited content. Some countries have data localization laws that apply to IM applications — research the regulatory requirements of your target markets before launching an overseas product.

5. Frequently Asked Questions

Q: Which platforms can the Uni App front end be published to?
A: Uni App compiles a single codebase into We Chat Mini Programs, Alipay Mini Programs, Android apps, iOS apps, and H5 web pages — covering virtually all common use cases. Each platform requires a separate build process, and We Chat Mini Programs require additional review and approval.

Q: How many users can be online simultaneously?
A: It depends on your server configuration and architecture. A 4-core, 8GB server can handle approximately 5,000 concurrent users in normal chat scenarios. If heavy voice and video calling is involved, deploying a dedicated media server or using CDN acceleration is recommended.

Q: What does “fully open-source PHP” mean — are there licensing restrictions?
A: Fully open-source means the API-side code is neither encrypted nor obfuscated, so you can freely modify and extend it. For specific commercial licensing terms, confirm with the source code provider to avoid future disputes.

Q: Does the system support fully private self-hosted deployment with no third-party data routing?
A: Yes. All data is stored on your own servers and does not pass through any third-party servers. This is one of the main reasons to choose self-hosted IM over SaaS platforms such as Rong Cloud or Huan Xin.

即时通讯系统演示

Source Reference

This article was created based on real deployment experience. Reference source: Multi-language Instant Messaging System / Social Chat System / Voice and Video Calls / UniApp Front End

#InstantMessagingSystem #SocialChatSourceCode #UniAppDevelopment #VoiceVideoCallSystem #PrivateIMDeployment