• Stars
    star
    12,719
  • Rank 2,520 (Top 0.05 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

IM Chat

⭐️ Open source Instant Messaging Server ⭐️

A+ good first

English 中文

What is Open-IM-Server

Open-IM-Server is an instant messaging server developed using pure Golang, adopting JSON over WebSocket as the communication protocol. In Open-IM-Server, everything is a message, so you can easily extend custom messages without modifying the server code. With a microservice architecture, Open-IM-Server can be deployed using clusters. By deploying Open-IM-Server on a server, developers can quickly integrate instant messaging and real-time networking features into their applications, ensuring the security and privacy of business data.

Open-IM-Server is not a standalone product and does not include account registration and login services. For your convenience, we have open-sourced the chat repository which includes login and registration functionality. By deploying the chat business server alongside Open-IM-Server, a chat product can be set up.

Features

  • Open source
  • Easy to integrate
  • Excellent scalability
  • High performance
  • Lightweight
  • Supports multiple protocols

Community

Quick Start

Deploying with docker-compose

  1. Clone the project
# choose what you need
BRANCH=release-v3.0
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
  1. Modify .env
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
  1. Deploy and start

Note
This command can only be executed once. It will modify the component passwords in docker-compose based on the PASSWORD variable in .env, and modify the component passwords in config/config.yaml. If the password in .env changes, you need to first execute docker-compose down; rm components -rf and then execute this command.

make install
  1. Check the service
make check

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/docker_build.png

Compile from source

Ur need Go 1.18 or higher version, and make.

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

Read about the OpenIM Version Policy

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

All services have been successfully built as shown in the figure

Successful Compilation

Component Configuration Instructions

The config/config.yaml file has detailed configuration instructions for the storage components.

  • 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
      

Start and Stop Services

Start services

./start_all.sh;

Check services

./check_all.sh

Stop services

./stop_all.sh

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 is an open source instant messaging component, it is not an independent product. This image shows the relationship between AppServer, AppClient, Open-IM-Server and Open-IM-SDK.

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png

Overall Architecture

https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg

To start developing OpenIM

The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.

Contributing

Contributions to this project are welcome! Please see CONTRIBUTING.md for details.

Community Meetings

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

We take notes of each biweekly meeting in GitHub discussions, and our minutes are written in Google Docs.

Who are using Open-IM-Server

The user case studies page includes the user list of the project. You can leave a 📝comment to let us know your use case.

avatar

License

Open-IM-Server is under the Apache 2.0 license. See the LICENSE file for details

More Repositories

1

openim-sdk-core

Instant Messaging
Go
352
star
2

open-im-sdk-flutter

IM SDK Flutter
Dart
338
star
3

open-im-flutter-demo

Demo developed based on flutter open IM SDK.
Dart
253
star
4

open-im-sdk-android

IM Android
Java
212
star
5

openim-electron-demo

Instant Messaging web desktop
TypeScript
155
star
6

open-im-sdk-ios

An OpenIM SDK in Objective-C for iOS
Objective-C
148
star
7

open-im-uniapp-demo

IM
Vue
143
star
8

openkf

AI ChatGPT| Supports chatgpt and llm large language models. OpenKF is an online customer service system that improves communication for enterprises and open-source communities with customizable features.
Go
140
star
9

open-im-sdk-web

IM web jssdk
TypeScript
103
star
10

open-im-android-demo

IM Android
Java
73
star
11

open-im-sdk-uniapp

即时通讯IM uniapp
Objective-C
63
star
12

chat

A business server that includes user registration and login, deployed together with Open-IM-Server, can be used to set up a chat product.
Go
51
star
13

openim-docs

OpenIM system documentation
Shell
44
star
14

open-im-ios-demo

Demo developed based on OpenIMSDK.
Swift
42
star
15

open-im-sdk-reactnative

IM ReactNative
Objective-C
38
star
16

open-im-sdk-web-wasm

JS SDK for OpenIM Web use by Webassembly of go
TypeScript
34
star
17

openim-docker

openim-docker configuration for deploying OpenIM. Provides a build solution for a stable distribution, as well as a docker compose deployment strategy
Shell
24
star
18

openmeeting-server

An open-source video conferencing solution, and alternative to Zoom
Go
22
star
19

tools

Go
17
star
20

ChatGPT

ChatGPT integrated IM
Python
15
star
21

cpp_go

Call Go function from C/C++ function
Go
15
star
22

community

Community Management for OpenIM
Shell
14
star
23

openim-h5-demo

TypeScript
13
star
24

protocol

Go
11
star
25

helm-charts

helm charts repository for openim
Smarty
11
star
26

Open-IM-Demo-Register

Go
10
star
27

Open-IM-h5-Demo

Vue
10
star
28

openim-charts

OpenIM-Charts: Kubernetes-ready Helm charts for deploying OpenIM, an open-source instant messaging system. Simplify deployment and management of scalable and secure IM infrastructure on Kubernetes.
Smarty
8
star
29

docs

OpenIM documentation v3
MDX
7
star
30

open-im-server-k8s-deploy

Open-IM-Server-k8s-deploy
Shell
6
star
31

gomake

gomake is a cross-platform compilation tool built on Mage, specifically designed for Go language projects. It offers comprehensive support for various operating systems and CPU architectures, covering the entire workflow from compilation to launching, monitoring, and stopping services.
Go
6
star
32

openim-sdk-core-ios

Objective-C
5
star
33

openim-sdk-cpp

IM SDK C/C++
C++
4
star
34

openim-reactnative-demo

TypeScript
4
star
35

openim-miniprogram-demo

JavaScript
3
star
36

openim-sdk-electron

TypeScript
2
star
37

sdk_advanced_function

This is sdk_advanced_function for vip
Go
2
star
38

k8s-jenkins

Makefile
2
star
39

.github

OpenIMSDK aim to be the top open source community
2
star
40

open-im-sdk-core-Indexdb-doc

Document description of the indexDB interface used by the openIM client
2
star
41

openKeeper

openIM zookeeper
Go
1
star
42

open_utils

Go
1
star
43

automation

OpenIM Automation, cicd, and actions, Robotics.
1
star
44

OpenMetaOffice-iOS

1
star
45

open-im-sdk-dotnet

C#
1
star
46

OpenMetaOffice-Flutter

Business authorization required
Dart
1
star
47

openim-msggateway-proxy

Go
1
star