https://github.com/Terry-Mao/goim
goim
https://github.com/Terry-Mao/goim
Last synced: over 1 year ago
JSON representation
goim
- Host: GitHub
- URL: https://github.com/Terry-Mao/goim
- Owner: Terry-Mao
- License: mit
- Created: 2015-04-30T13:01:32.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-05-05T02:28:56.000Z (over 3 years ago)
- Last Synced: 2024-10-29T14:59:38.985Z (almost 2 years ago)
- Language: Go
- Homepage: https://goim.io/
- Size: 12.2 MB
- Stars: 7,194
- Watchers: 397
- Forks: 1,782
- Open Issues: 63
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - goim - 支持集群的 im 及实时推送服务 (开源类库 / 即时通信)
- go-awesome - goim - supports clustered IM and real-time push services (Open source library / Instant Messages)
- awesome-go - Terry-Mao/goim - goim (Other / General Purpose Libraries)
- my-awesome - Terry-Mao/goim - 05 star:7.4k fork:1.8k goim (Go)
README
goim v2.0
==============
[](https://golang.org/)
[](https://github.com/Terry-Mao/goim/actions)
[](https://pkg.go.dev/github.com/Terry-Mao/goim)
[](https://goreportcard.com/report/github.com/Terry-Mao/goim)
goim is an im server writen in golang.
## Features
* Light weight
* High performance
* Pure Golang
* Supports single push, multiple push and broadcasting
* Supports one key to multiple subscribers (Configurable maximum subscribers count)
* Supports heartbeats (Application heartbeats, TCP, KeepAlive, HTTP long pulling)
* Supports authentication (Unauthenticated user can't subscribe)
* Supports multiple protocols (WebSocket,TCP,HTTP)
* Scalable architecture (Unlimited dynamic job and logic modules)
* Asynchronous push notification based on Kafka
## Architecture

## Quick Start
### Build
```
make build
```
### Run
```
make run
make stop
// or
nohup target/logic -conf=target/logic.toml -region=sh -zone=sh001 -deploy.env=dev -weight=10 2>&1 > target/logic.log &
nohup target/comet -conf=target/comet.toml -region=sh -zone=sh001 -deploy.env=dev -weight=10 -addrs=127.0.0.1 2>&1 > target/logic.log &
nohup target/job -conf=target/job.toml -region=sh -zone=sh001 -deploy.env=dev 2>&1 > target/logic.log &
```
### Environment
```
env:
export REGION=sh
export ZONE=sh001
export DEPLOY_ENV=dev
supervisor:
environment=REGION=sh,ZONE=sh001,DEPLOY_ENV=dev
go flag:
-region=sh -zone=sh001 deploy.env=dev
```
### Configuration
You can view the comments in target/comet.toml,logic.toml,job.toml to understand the meaning of the config.
### Dependencies
[Discovery](https://github.com/bilibili/discovery)
[Kafka](https://kafka.apache.org/quickstart)
## Document
[Protocol](./docs/protocol.png)
[English](./README_en.md)
[中文](./README_cn.md)
## Examples
Websocket: [Websocket Client Demo](https://github.com/Terry-Mao/goim/tree/master/examples/javascript)
Android: [Android](https://github.com/roamdy/goim-sdk)
iOS: [iOS](https://github.com/roamdy/goim-oc-sdk)
## Benchmark

### Benchmark Server
| CPU | Memory | OS | Instance |
| :---- | :---- | :---- | :---- |
| Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz | DDR3 32GB | Debian GNU/Linux 8 | 1 |
### Benchmark Case
* Online: 1,000,000
* Duration: 15min
* Push Speed: 40/s (broadcast room)
* Push Message: {"test":1}
* Received calc mode: 1s per times, total 30 times
### Benchmark Resource
* CPU: 2000%~2300%
* Memory: 14GB
* GC Pause: 504ms
* Network: Incoming(450MBit/s), Outgoing(4.39GBit/s)
### Benchmark Result
* Received: 35,900,000/s
[中文](./docs/benchmark_cn.md)
[English](./docs/benchmark_en.md)
## LICENSE
goim is is distributed under the terms of the MIT License.