Open-IM-Server

module
v1.3.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: Apache-2.0

README ยถ

โญ๏ธ Open source Instant Messaging Server โญ๏ธ

good first

English โ€ข ็ฎ€ไฝ“ไธญๆ–‡ โ€ข Docs

โœจ About OpenIM

Open-IM-Server, meticulously developed in pure Golang, is a powerful instant messaging server. Its distinct communication method, employing pb+websocket, views every interaction as a message, streamlining customization without altering server code. Built on a microservice architecture, it offers deployment through clusters for outstanding performance and scalability.

Open-IM-Server is more than an instant messaging server; it's a powerful tool for incorporating real-time networking into your applications, positioning itself as your premier choice for integration! ๐Ÿš€

Please be aware that Open-IM-Server does not function as a standalone product and does not offer built-in account registration or login services. To ease your implementation process, we've open-sourced the chat repository, which comprises these features. Deploying this chat business server in conjunction with Open-IM-Server expedites the setup of a comprehensive chat product. ๐Ÿ‘ฅ

Further enhancing your experience, we also provide an SDK client, wherein most complex logics are implemented. The SDK repository can be found at this link. The chat repository is our business server while the 'core' represents the high-level encapsulation of the SDK, synergistically working together to deliver superior results. โœจ

๐ŸŒŸ Why OpenIM

๐Ÿ” Function screenshot display

๐Ÿ’ป๐Ÿ”„๐Ÿ“ฑ Multi Terminal Synchronization ๐Ÿ”„๐Ÿ–ฅ๏ธ ๐Ÿ“…โšก Efficient Meetings ๐Ÿš€๐Ÿ’ผ
multiple-message efficient-meetings
๐Ÿ“ฒ๐Ÿ”„ One-to-one and Group Chats ๐Ÿ‘ฅ๐Ÿ—ฃ๏ธ ๐ŸŽ๐Ÿ’ป Special Features - Custom Messages โœ‰๏ธ๐ŸŽจ
group-chat special-function
  1. Comprehensive Message Type Support ๐Ÿ’ฌ

    โœ… Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more

    โœ… Supports one-on-one and multi-person audio and video calls

    โœ… Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5

  2. Efficient Meetings Anytime, Anywhere ๐ŸŒŽ

    โœ… Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications

    โœ… Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording

  3. One-on-one and Group Chats for Various Social Scenarios ๐Ÿ‘ฅ

    โœ… OpenIM has four roles: application administrator, group owner, group administrator, and regular member

    โœ… Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed

  4. Unique Features ๐ŸŒŸ

    โœ… Supports read-and-burn private chats, customizable duration

    โœ… Message editing function broadens social scenarios, making instant communication more diverse and interesting

  5. Open Source ๐Ÿ‘

    โœ… The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server

    โœ… Based on open source Server, many excellent open source projects have been developed, such as OpenKF (Open source AI customer service system)

  6. Easy to Expand ๐Ÿ”ง

    โœ… The OpenIM server is implemented in Golang, introducing an innovative "everything is a message" communication model, simplifying the implementation of custom messages and extended features

  7. High Performance ๐ŸŽ

    โœ… OpenIM supports a hierarchical governance architecture in the cluster, tested by a large number of users, and abstracts the storage model of online messages, offline messages, and historical messages

  8. Full Platform Support ๐Ÿ“บ

    โœ… Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron

  9. The ultimate deployment experience ๐Ÿค–

    โœ… Supports cluster deployment

    โœ… Supports multi-architecture mirroring, our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit our GitHub packages and read our version management document for more information.

  10. A large ecosystem of open source communities ๐Ÿคฒ

    โœ… We have tens of thousands of users and many solutions to problems.

    โœ… We have a large open source community called OpenIMSDK that runs the core modules, we have an open source community called openim-sigs to explore more IM-based infrastructure products.

๐Ÿš€ Quick Start

You can quickly learn OpenIM engineering solutions, all it takes is one simple command:

$ make demo

๐Ÿคฒ In order to facilitate the user experience, we have provided a variety of deployment solutions, you can choose your own deployment method according to the list below:

Deploying with Docker Compose

docker compose will not be maintained in future versions, but it is still the easiest and most convenient way to organize docker compose deployments into a separate project https://github.com/openim-sigs/openim-docker to maintain.

1. Clone the project

# choose what you need, We take branch 3.2 as an example
$ BRANCH=release-v3.2
$ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim/openim-server && export openim_dir=$(pwd)/openim && cd ${openim_dir}/openim-server

Note If you don't know OpenIM's versioning policy, ๐Ÿ“šRead our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md

2. Configure the config file

If you tried to get started quickly with make demo, then you know that our config file is generated by automation.

You can use make init to quickly initialize a configuration file

$ make init
$ git diff

Then feel free to modify your current config file, you can also modify /scripts/install/environment.sh document template, make init is essentially rendering environment.sh template, and then through the make init to automatically generate a new configuration.

If you only need to change the config file for a short time, or if you don't want to make any major changes in the future, you can modify the `.env file directly

USER=root 								#no need to modify
PASSWORD=openIM123  					#A combination of 8 or more numbers and letters, this password applies to redis, mysql, mongo, as well as accessSecret in config/config.yaml
ENDPOINT=http://127.0.0.1:10005 		#minio's external service IP and port, or use the domain name storage.xx.xx, the app must be able to access this IP and port or domain,
API_URL=http://127.0.0.1:10002/object/ 	#the app must be able to access this IP and port or domain,
DATA_DIR=./  							#designate large disk directory

3. Deploy and start

Note

You can deploy either directly with make install or with docker compose up, the logic is the same

$ make install
# OR
$ docker-compose up
  1. Check the service
$ make check

Looking at the command line at this point, there are two items in the output, checking for the start of the component port that OpenIM depends on, and the start of the OpenIM core component

Compile from Source

Ur need Go 1.18 or higher version, and make.

go version && make --version || echo "Error: One of the commands failed."

Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md

# choose what you need
$ BRANCH=release-v3.1
$ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make start

make help to help you see the instructions supported by OpenIM.

Use make check to check all component starts

$ make check

You can use the make help-all see OpenIM in action.

Component Configuration Instructions The `config/config.yaml` file has detailed configuration instructions for the storage components.

The config file is available via environment.sh configuration openim.yaml template, and then through the make init to automatically generate a new configuration.

  • Zookeeper

    • Used for RPC service discovery and registration, cluster support.

      zookeeper:
        schema: openim                          #Not recommended to modify
        address: [ 127.0.0.1:2181 ]             #address
        username:                               #username
        password:                               #password
      
  • MySQL

    • Used for storing users, relationships, and groups, supports master-slave database.

      mysql:
        address: [ 127.0.0.1:13306 ]            #address
        username: root                          #username
        password: openIM123                     #password
        database: openIM_v2                     #Not recommended to modify
        maxOpenConn: 1000                       #maximum connection
        maxIdleConn: 100                        #maximum idle connection
        maxLifeTime: 60                         #maximum time a connection can be reused (seconds)
        logLevel: 4                             #log level 1=slient 2=error 3=warn 4=info
        slowThreshold: 500                      #slow statement threshold (milliseconds)
      
  • Mongo

    • Used for storing offline messages, supports mongo sharded clusters.

      mongo:
        uri:                                    #Use this value directly if not empty
        address: [ 127.0.0.1:37017 ]            #address
        database: openIM                        #default mongo db
        username: root                          #username
        password: openIM123                     #password
        maxPoolSize: 100                        #maximum connections
      
  • Redis

    • Used for storing message sequence numbers, latest messages, user tokens, and mysql cache, supports cluster deployment.

      redis:
        address: [ 127.0.0.1:16379 ]            #address
        username:                               #username
        password: openIM123                     #password
      
  • Kafka

    • Used for message queues, for message decoupling, supports cluster deployment.

      kafka:
        username:                               #username
        password:                               #password
        addr: [ 127.0.0.1:9092 ]                #address
        latestMsgToRedis:
          topic: "latestMsgToRedis"
        offlineMsgToMongo:
          topic: "offlineMsgToMongoMysql"
        msgToPush:
          topic: "msqToPush"
        msgToModify:
          topic: "msgToModify"
        consumerGroupID:
          msgToRedis: redis
          msgToMongo: mongo
          msgToMySql: mysql
          msgToPush: push
          msgToModify: modify
      
Deployed with kubernetes

read: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/deployments/README.md

Open IM Ports
TCP Port Description Operation
TCP:10001 ws protocol, message port such as message sending, pushing etc, used for client SDK Port release or nginx reverse proxy, and firewall off
TCP:10002 api port, such as user, friend, group, message interfaces. Port release or nginx reverse proxy, and firewall off
TCP:10005 Required when choosing minio storage (openIM uses minio storage by default) Port release or nginx reverse proxy, and firewall off
Open Chat Ports
TCP Port Description Operation
TCP:10008 Business system, such as registration, login etc Port release or nginx reverse proxy, and firewall off
TCP:10009 Management backend, such as statistics, banning etc Port release or nginx reverse proxy, and firewall off

๐Ÿ”— Relationship Between APP and OpenIM

OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, Open-IM-Server, and Open-IM-SDK interact.

App-OpenIM Relationship

๐Ÿ— Overall Architecture

Delve into the heart of Open-IM-Server's functionality with our architecture diagram.

Overall Architecture

๐Ÿ›  To start developing OpenIM

OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the Community repository.

If you'd like to contribute to this Open-IM-Server repository, please read our contributor documentation.

Before you start, please make sure your changes are in demand. The best for that is to create a new discussion OR Slack Communication, or if you find an issue, report it first.

๐Ÿ‘ฅ Community

๐Ÿ“† Community Meetings

We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.

Our conference is in the OpenIM Slack ๐ŸŽฏ, then you can search the Open-IM-Server pipeline to join

We take notes of each biweekly meeting in GitHub discussions, Our historical meeting notes, as well as replays of the meetings are available at Google Docs ๐Ÿ“‘.

๐Ÿ‘€ Who are using OpenIM

Check out our user case studies page for a list of the project users. Don't hesitate to leave a ๐Ÿ“comment and share your use case.

๐Ÿ“„ License

OpenIM is licensed under the Apache 2.0 license. See LICENSE for the full license text.

The OpenIM logo, including its variations and animated versions, displayed in this repository OpenIM under the assets/logo and assets/logo-gif directories, are protected by copyright laws.

๐Ÿ”ฎ Thanks to our contributors!

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL