Awesome Open Source
Awesome Open Source


Build Status codecov codebeat badge release last commit

IM is a lightweight instant messaging server. It also provides a client jar,allows you to develop your own client.For example,with spring boot. It's able to login with your own login system or with ldap.



  • One to one text/file message
  • Sent/Delivered/Read message
  • Ldap Authentication
  • Authenticate with individual login system
  • Horizontal expansion
  • Provide client jar

Quick Start


We use docker to quick start IM.

# detect if the docker environment is avaliable.
docker -v
# clone the repository
git clone [email protected]:yuanrw/IM.git


cd IM/docker
docker-compose up

There is a simple sample in the container,it starts serveral clients and send messages to their friends randomly,printing logs which are similar with followed:

2019-08-11 17:29:13.451 client-samples - [Olive] get a msg: 357980857883037697 has been read
2019-08-11 17:29:13.452 client-samples - [yuanrw] get a msg: 357980857887232002 has been read
2019-08-11 17:29:13.452 client-samples - [xianyy] get a msg: 357980857887232001 has been read
2019-08-11 17:29:13.452 client-samples - [Adela] get a msg: 357980857874649089 has been read
2019-08-11 17:29:13.452 client-samples - [Bella] get a msg: 357980857874649090 has been read
2019-08-11 17:29:13.452 client-samples - [Tom] get a msg: 357980857887232000 has been read

sentMsg: 51, readMsg: 51, hasSentAck: 51, hasDeliveredAck: 51, hasReadAck: 51, hasException: 0

2019-08-11 17:29:15.114 client-samples - [Bella]get a msg: 357980866275840002 has been sent
2019-08-11 17:29:15.114 client-samples - [Adela]get a msg: 357980866275840000 has been sent
2019-08-11 17:29:15.114 client-samples - [Cynthia]get a msg: 357980866275840003 has been sent

Distributed Deploy

mvn clean package -DskipTests

get $SERVICE_NAME-$ under dir /target

Environment Requirement

  • java 8+
  • mysql 5.7+
  • rabbitmq
  • redis


Start services with the following order: rest-web --> transfer -->connector

Here are the steps for start rest-web,transfer and connector are similar with it.


  1. Unzip
unzip rest-web-$
cd rest-web-$VERSION
  1. Update the config file

# your log path

# your jdbc config

# your redis config

# your rabbitmq config
  1. run the sql in the file rest.sql

  2. start server

java -jar rest-web-$VERSION.jar


java -jar transfer-$VERSION.jar


java -jar connector-$VERSION.jar

Nginx Config

All services are available to expand horizontally,connections need to be kept alive between each client and connector server. A sample nginx config:

stream {
	upstream backend {
        # connector services port
        server         max_fails=3 fail_timeout=30s;
        server			max_fails=3 fail_timeout=30s;

    server {
        # to keep a persistent connection
        listen 9999 so_keepalive=on;
        proxy_timeout 1d;
        proxy_pass backend;


There is a simple usable login system in IM. IM also support the following two ways to authenticate.


We use open ldap as an example. update

# the following config should be replace with your own config
# admin
# user filter,use the filter to search user when login in
# search base eg. ou=dev
# user objectClass
java -jar rest-web-$VERSION.jar

individual login system

  1. Implement the spi in
public interface UserSpi<T extends UserBase> {

     * get user by username and password, return user(id can not be null)
     * if username and password are right, else return null.
     * <p>
     * be sure that your password has been properly encrypted
     * @param username
     * @param pwd
     * @return
    T getUser(String username, String pwd);

     * get user by id, if id not exist then return null.
     * @param id
     * @return
    T getById(String id);
  1. Update
# your implement class full name
  1. Build
mvn clean package -DskipTests

Use client jar

A client demo:

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (31,357
spring-boot (766
spring (516
protobuf (203
netty (152
im (79
ldap (78
instant-messaging (51
webflux (24
client-server (19