OpenIM Electron ๐Ÿ’ฌ๐Ÿ’ป

March 14, 2025 ยท View on GitHub

OpenIM Electron ๐Ÿ’ฌ๐Ÿ’ป

OpenIM Docs โ€ข OpenIM Server โ€ข openim-sdk-wasm โ€ข openim-sdk-electron โ€ข openim-sdk-core

OpenIM provides an open-source Instant Messaging (IM) SDK for developers, serving as an alternative solution to cloud services like Twilio and Sendbird. With OpenIM, developers can build secure and reliable IM applications similar to WeChat, Zoom, and Slack.

This repository is based on the open-source version of the OpenIM SDK, offering an Electron-based IM application. You can use this application as a reference implementation of the OpenIM SDK. It references both @openim/electron-client-sdk and @openim/wasm-client-sdk, which are the Electron and Web versions of the SDK, respectively. This enables the creation of both PC Web applications and desktop applications (Windows, macOS, Linux).

Preview

License :page_facing_up:

This repository adopts the GNU Affero General Public License v3 (AGPL-3.0) with additional terms. Commercial use is not permitted. For more details, please refer to here.

Development Environment

Before you start developing, please ensure that your system has the following software installed:

  • Operating System: Windows 10 or above, macOS 10.15 or above
  • Node.js: Version โ‰ฅ 16.x (manual installation or via nvm)
  • npm: Version โ‰ฅ 6.x (installed with Node.js)
  • Git: For version control

You also need to have the latest version of the OpenIM Server deployed. After that, you can compile this project and connect it to your own server for testing.

Runtime Environment

This application supports the following browsers and operating system versions:

Browser/OSVersionStatus
Chrome78 and aboveโœ…
WindowsWindows 10 and aboveโœ…
macOS10.15 and aboveโœ…
Linux20.04 and aboveโœ…

Note

  • Chrome: It is recommended to use the latest version for the best experience.
  • Operating System: Make sure your system meets the version requirements to avoid compatibility issues.

Quick Start

Follow these steps to set up your local development environment:

  1. Clone the repository

    git clone https://github.com/openimsdk/openim-electron-demo.git
    cd openim-electron-demo
    
  2. Install dependencies

    npm install
    
  3. Modify the configuration

    • In the .env file:

      If you haven't changed the default server port, simply change VITE_BASE_HOST to your server IP. If you need to set up a domain and HTTPS access, please refer to nginx configuration, use the configuration at the bottom, and modify VITE_BASE_DOMAIN to your domain name.

      VITE_BASE_HOST=your-server-ip
      
      VITE_WS_URL=ws://$VITE_BASE_HOST:10001
      VITE_API_URL=http://$VITE_BASE_HOST:10002
      VITE_CHAT_URL=http://$VITE_BASE_HOST:10008
      
      # VITE_BASE_DOMAIN=your-server-domain
      
      # VITE_WS_URL=wss://$VITE_BASE_DOMAIN/msg_gateway
      # VITE_API_URL=https://$VITE_BASE_DOMAIN/api
      # VITE_CHAT_URL=https://$VITE_BASE_DOMAIN/chat
      
  4. Run npm run dev to start the development server. Access http://localhost:5173 to view the result. By default, the Electron application will also start.

  5. Start developing and testing! ๐ŸŽ‰

Audio/Video Calls

The open-source version supports one-to-one audio and video calls. You need to first deploy and configure the server. For multi-party audio/video calls or video conferencing, please contact us at contact@openim.io.

Note

  • To enable audio and video calls on the web, you can only debug locally (localhost) or deploy the application to an HTTPS site for use. This limitation is due to browser security policies.

Build ๐Ÿš€

This project allows separate builds for the Web application and the Electron application, but there are some differences in the build process.

Web Application

  1. Run the following command to build the Web application:
    npm run build
    
  2. The build artifacts will be located in the dist directory.

Electron Application

  1. Replace the content of package.json with the content from package_electron.json, retaining only the dependencies required by Electron. This significantly reduces the package size. Also, modify the build scripts accordingly.

  2. On the corresponding system, run one of the following commands to build the Electron application:

    For cross-compilation, it is only supported to build other system installers on macOS. On Windows or Linux, you can only build installers for the same system.

    • macOS:
      npm run build:mac
      
    • Windows:
      npm run build:win
      
    • Linux:
      npm run build:linux
      
  3. The build artifacts will be located in the release directory.

Features

Description

Feature ModuleFeatureStatus
Account FeaturesPhone number registration \ Email registration \ Verification code loginโœ…
View \ Edit personal informationโœ…
Multi-language settingsโœ…
Change password \ Forgot passwordโœ…
Friend FeaturesFind \ Apply \ Search \ Add \ Delete friendsโœ…
Accept \ Reject friend requestsโœ…
Friend notesโœ…
Allow friend requests or notโœ…
Friend list \ Friend data real-time syncingโœ…
BlocklistRestrict messagesโœ…
Real-time syncing of blocklistโœ…
Add \ Remove from blocklistโœ…
Group FeaturesCreate \ Dismiss groupsโœ…
Apply to join \ Invite to join \ Leave group \ Remove membersโœ…
Group name / Avatar changes / Group data updates (notifications, real-time sync)โœ…
Invite members to groupโœ…
Transfer group ownershipโœ…
Group owner or admin approve join requestsโœ…
Search group membersโœ…
Message FeaturesOffline messagesโœ…
Roaming messagesโœ…
Multi-end messagesโœ…
Message historyโœ…
Message deletionโœ…
Clear messagesโœ…
Copy messagesโœ…
Typing indicator in single chatโœ…
Do Not Disturb for new messagesโœ…
Clear chat historyโœ…
New members can view group chat historyโœ…
New message remindersโœ…
Text messagesโœ…
Image messagesโœ…
Video messagesโœ…
Emoji messagesโœ…
File messagesโœ…
Voice messagesโœ…
Contact card messagesโœ…
Location messagesโœ…
Custom messagesโœ…
ConversationPin conversationโœ…
Mark conversation as readโœ…
Mute conversationโœ…
REST APIAuthentication managementโœ…
User managementโœ…
Relationship chain managementโœ…
Group managementโœ…
Conversation managementโœ…
Message managementโœ…
WebhookGroup callbacksโœ…
Message callbacksโœ…
Push callbacksโœ…
Relationship callbacksโœ…
User callbacksโœ…
Capacity & Performance10,000 friendsโœ…
100,000-member supergroupโœ…
Second-level syncingโœ…
Cluster deploymentโœ…
Multi-device kick-out strategyโœ…
Online StatusNo mutual kick-out across all platformsโœ…
Each platform can only log in with one deviceโœ…
PC, Mobile, Pad, Web, Mini Program each can log in with one deviceโœ…
PC not mutually kicked, only one device total for other platformsโœ…
Audio/Video CallOne-to-one audio and video callsโœ…
File StorageSupports private Minio deploymentโœ…
Supports public cloud services COS, OSS, Kodo, S3โœ…
PushReal-time online message pushโœ…
Offline message push, supports Getui, Firebaseโœ…

For more advanced features, audio/video calls, or video conferences, please contact us at contact@openim.io.

Join Our Community :busts_in_silhouette:

FAQ

  1. When publishing to the web, how to solve slow WASM loading?

    Answer: Use gzip compression on the WASM file to significantly reduce the size. You can also leverage a CDN to accelerate loading.

  2. CKEditorError: ckeditor-duplicated-modules

    Answer: This is due to dependency conflicts. Run npm dedupe to clean up dependencies.