{"id":15103702,"url":"https://github.com/yuanrw/im","last_synced_at":"2025-09-27T02:31:46.173Z","repository":{"id":49407369,"uuid":"184854915","full_name":"yuanrw/IM","owner":"yuanrw","description":"IM server based on netty. Provides a client jar. Integrate with your own login system.基于netty实现的IM服务端,提供客户端jar包,可集成自己的登录系统","archived":true,"fork":false,"pushed_at":"2021-03-31T21:15:24.000Z","size":634,"stargazers_count":690,"open_issues_count":1,"forks_count":315,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-01-17T14:35:13.929Z","etag":null,"topics":["client-jar","client-server","im","instant-messaging","java","ldap","ldap-authentication","mircoservices","netty","proto","protobuf","spring","spring-boot","webflux"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuanrw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-04T05:12:42.000Z","updated_at":"2025-01-07T15:43:55.000Z","dependencies_parsed_at":"2022-07-26T18:02:26.606Z","dependency_job_id":null,"html_url":"https://github.com/yuanrw/IM","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yuanrw/IM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanrw%2FIM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanrw%2FIM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanrw%2FIM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanrw%2FIM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuanrw","download_url":"https://codeload.github.com/yuanrw/IM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanrw%2FIM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277171528,"owners_count":25773234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-jar","client-server","im","instant-messaging","java","ldap","ldap-authentication","mircoservices","netty","proto","protobuf","spring","spring-boot","webflux"],"created_at":"2024-09-25T19:41:33.000Z","updated_at":"2025-09-27T02:31:45.594Z","avatar_url":"https://github.com/yuanrw.png","language":"Java","readme":"# IM\n[![Build Status](https://travis-ci.org/yuanrw/IM.svg?branch=master)](https://travis-ci.org/yuanrw/IM)\n[![codecov](https://codecov.io/gh/yuanrw/IM/branch/master/graph/badge.svg)](https://codecov.io/gh/yuanrw/IM)\n[![codebeat badge](https://codebeat.co/badges/be93165e-76f7-473b-ae45-7c8b5e7b7a87)](https://codebeat.co/projects/github-com-yuanrw-im-master)\n[![release](https://img.shields.io/github/v/release/yuanrw/IM?include_prereleases)](https://github.com/yuanrw/IM/releases)\n[![last commit](https://img.shields.io/github/last-commit/yuanrw/IM)]()\n\nIM 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.\n\n[中文](https://github.com/yuanrw/IM/blob/dev/README_CH.md)\n\n## Features\n* One to one text/file message\n* Sent/Delivered/Read message\n* Ldap Authentication\n* Authenticate with individual login system\n* Horizontal expansion\n* Provide client jar\n\n## Quick Start\n\n### Prepare\nWe use docker to quick start IM.\n\n```\n# detect if the docker environment is avaliable.\ndocker -v\n```\n```\n# clone the repository\ngit clone git@github.com:yuanrw/IM.git\n```\n\n### Start\n\n```\ncd IM/docker\ndocker-compose up\n```\n\nThere 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:\n\n```\n......\n2019-08-11 17:29:13.451 client-samples - [Olive] get a msg: 357980857883037697 has been read\n2019-08-11 17:29:13.452 client-samples - [yuanrw] get a msg: 357980857887232002 has been read\n2019-08-11 17:29:13.452 client-samples - [xianyy] get a msg: 357980857887232001 has been read\n2019-08-11 17:29:13.452 client-samples - [Adela] get a msg: 357980857874649089 has been read\n2019-08-11 17:29:13.452 client-samples - [Bella] get a msg: 357980857874649090 has been read\n2019-08-11 17:29:13.452 client-samples - [Tom] get a msg: 357980857887232000 has been read\n\n\n\nsentMsg: 51, readMsg: 51, hasSentAck: 51, hasDeliveredAck: 51, hasReadAck: 51, hasException: 0\n\n\n\n2019-08-11 17:29:15.114 client-samples - [Bella]get a msg: 357980866275840002 has been sent\n2019-08-11 17:29:15.114 client-samples - [Adela]get a msg: 357980866275840000 has been sent\n2019-08-11 17:29:15.114 client-samples - [Cynthia]get a msg: 357980866275840003 has been sent\n......\n```\n\n## Distributed Deploy\n```\nmvn clean package -DskipTests\n```\nget $SERVICE_NAME-$VERSION-bin.zip under dir /target\n\n### Environment Requirement\n* java 8+\n* mysql 5.7+\n* rabbitmq\n* redis\n\n### Start\nStart services with **the following order**:\nrest-web --\u003e transfer --\u003econnector\n\nHere are the steps for start rest-web,transfer and connector are similar with it.\n\n#### rest-web\n1. Unzip\n\n```\nunzip rest-web-$VERSION-bin.zip\ncd rest-web-$VERSION\n```\n\n2. Update the config file\n\n```\nserver.port=8082\n\n# your log path\nlog.path=\n\n# your jdbc config\nspring.datasource.url=\n......\n\n# your redis config\nspring.redis.host=\n......\n\n# your rabbitmq config\nspring.rabbitmq.host=\n......\n```\n\n3. run the sql in the file `rest.sql`\n\n4. start server\n\n```\njava -jar rest-web-$VERSION.jar --spring.config.location=application.properties\n```\n\n#### transfer\n```\njava -jar -Dconfig=transfer.properties transfer-$VERSION.jar\n```\n\n#### connector\n```\njava -jar -Dconfig=connector.properties connector-$VERSION.jar\n```\n\n## Nginx Config\nAll services are available to expand horizontally,connections need to be kept alive between each client and connector server.\nA sample nginx config:\n\n```\nstream {\n\tupstream backend {\n        # connector services port\n        server 127.0.0.1:9081         max_fails=3 fail_timeout=30s;\n        server 127.0.0.1:19081\t\t\tmax_fails=3 fail_timeout=30s;\n\t}\n\n    server {\n        # to keep a persistent connection\n        listen 9999 so_keepalive=on;\n        proxy_timeout 1d;\n        proxy_pass backend;\n    }\n}\n```\n\n## Login\nThere is a simple usable login system in IM. \nIM also support the following two ways to authenticate.\n\n### ldap\nWe use open ldap as an example.\nupdate application.properties\n```\nspi.user.impl.class=com.yrw.im.rest.web.spi.impl.LdapUserSpiImpl\n\n# the following config should be replace with your own config\nspring.ldap.base=dc=example,dc=org\n# admin\nspring.ldap.username=cn=admin,dc=example,dc=org\nspring.ldap.password=admin\nspring.ldap.urls=ldap://127.0.0.1:389\n# user filter，use the filter to search user when login in\nspring.ldap.searchFilter=\n# search base eg. ou=dev\nldap.searchBase=\n# user objectClass\nldap.mapping.objectClass=inetOrgPerson\nldap.mapping.loginId=uid\nldap.mapping.userDisplayName=gecos\nldap.mapping.email=mail\n```\n```\njava -jar rest-web-$VERSION.jar --spring.config.location=application.properties\n```\n### individual login system\n1. Implement the spi in `com.yrw.im.rest.spi.UserSpi`\n\n```\npublic interface UserSpi\u003cT extends UserBase\u003e {\n\n    /**\n     * get user by username and password, return user(id can not be null)\n     * if username and password are right, else return null.\n     * \u003cp\u003e\n     * be sure that your password has been properly encrypted\n     *\n     * @param username\n     * @param pwd\n     * @return\n     */\n    T getUser(String username, String pwd);\n\n    /**\n     * get user by id, if id not exist then return null.\n     *\n     * @param id\n     * @return\n     */\n    T getById(String id);\n}\n```\n\n2. Update application.properties\n\n```\n# your implement class full name\nspi.user.impl.class=\n```\n\n3. Build\n\n```\nmvn clean package -DskipTests\n```\n\n## Use client jar\nA client demo:\n\n[MyClient.java](https://github.com/yuanrw/IM/blob/master/client-samples/src/main/java/com/github/yuanrw/im/client/sample/MyClient.java)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanrw%2Fim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuanrw%2Fim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanrw%2Fim/lists"}