LINBOX is a distributed IM system designed for www.medtree.cn.
Download medtree app for iphone at here
Download medtree app for android at here
- Netty and tcp protocol
- Kafka as center MQ
- Dubbo as rpc framework
- Zookeeper as config center
Build the project:
gradle zip
distribution package is under
build/distribution/linbox_server-1.0.zip
Unzip it and start the server:
# start the tcp client:
sh tcpServer.sh
# start the router:
sh consumer.sh
# start the rpc client
sh rpcServer.sh
Linbox is distributed by design. All of the components of linbox - tcp client, rpc client and router - are all distributed.
Steps to prompt availability:
- Use zookeeper cluster
- Use Kafka cluster
- Use tcp client cluster
- im.properties need tobe configured for server hosts and ports
- Use rpc client cluster
- rpc.xml need to be configured for pointed rpc port, or you can use dynamic ports generated by system.
- Use router client cluster
JDK-1.8 is required to build and run it.
Be carefual: as we use AES-256 encryption, you need to download packages to update your local jre environment.
- Download package at here
- Unzip and copy the jars into
${java.home}/jre/lib/security/
Click this for detail information for this problem.
Mysql database is used as persistence storage for im messages.
There is no special requirement for mysql version. But if you want to use emojis, you need to use mysql version 5.6+, and config the character set to utf8mb4.
You can find all mysql operations in package com.linbox.im.server.storage
There are 4 tables predefined in programs, sql script could be find in mysql.sql
Config mysql connection in im.properties
Config redis connection in im.properties
Zookeeper is used as config center of the project. It is also a dependency of dubbo and Kafka. Config Zookeeper in rpc.xml
Kafka is used as Center MQ. Kafka is configd in im.properties
Linbox use tcp protocal and JSON structure in communication. Data package structure is designed as below:
Version | Type | Length | Content |
---|---|---|---|
2 Byte | 2 Byte | 4 Byte | JSON String |
Name | Description |
---|---|
Version | A flag to show the protocol version of the package |
Type | Request / Response command type |
Length | The length of the content part |
Content | Encrypted Data content structured in json |