Coder Social home page Coder Social logo

gobelieveio / im_service Goto Github PK

View Code? Open in Web Editor NEW
1.9K 117.0 600.0 1.33 MB

golang im server

License: GNU General Public License v2.0

Makefile 1.14% Go 85.72% Python 13.14%
golang go im free-software open-source server chat chat-application instant-messaging messaging

im_service's Introduction

im service

  1. 支持点对点消息, 群组消息, 聊天室消息
  2. 支持集群部署
  3. 单机支持50w用户在线
  4. 单机处理消息5000条/s
  5. 支持超大群组(3000人)

服务器硬件指标:32g 16核

编译运行

  1. 安装go编译环境

    版本要求:支持module,高于v1.11 参考链接:https://golang.org/doc/install

  2. 下载im_service代码

    git clone https://github.com/GoBelieveIO/im_service.git

  3. 编译

    cd im_service

    mkdir bin

    make install

    可执行程序在bin目录下

  4. 安装mysql数据库, redis, 并导入db.sql

  5. 配置程序 配置项的说明参考ims.cfg.sample, imr.cfg.sample, im.cfg.sample

  6. 启动程序

  • 创建配置文件中配置的im&ims消息存放路径

    mkdir /tmp/im

    mkdir /tmp/impending

  • 创建日志文件路径

    mkdir /data/logs/ims

    mkdir /data/logs/imr

    mkdir /data/logs/im

  • 启动im服务

    pushd `dirname $0` > /dev/null

    BASEDIR=`pwd`

    nohup $BASEDIR/ims ims.cfg >/data/logs/ims/ims.err 2>&1 &

    nohup $BASEDIR/imr imr.cfg >/data/logs/imr/imr.err 2>&1 &

    nohup $BASEDIR/im im.cfg >/data/logs/im/im.err 2>&1 &

token的格式

连接im服务器token存储在redis的hash对象中,脱离API服务器测试时,可以手工生成。
$token就是客户端需要获得的, 用来连接im服务器的认证信息。
key:access_token_$token
field:
    user_id:用户id
    app_id:应用id

官方QQ群

  1. 450359487(一群),已满。
  2. 416969931(二群),加群请附加说明信息。

官方网站

https://developer.gobelieve.io/

相关产品

https://goubuli.mobi/

im_service's People

Contributors

bryant1410 avatar daibou007 avatar lostdragon avatar richmonkey avatar sundb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

im_service's Issues

没有目录结构

您好,东西挺好的,能不能把目录结构加上,要不然看起开很难受呀

执行安装依赖 dep ensure 报错

image

图上的信息如下:

The following issues were found in Gopkg.toml:

  ✗ unable to deduce repository and source type for "golang.org/x/net": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://golang.org/x/net?go-get=1": Get http://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:80: i/o timeout
  ✗ unable to deduce repository and source type for "google.golang.org/grpc": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://google.golang.org/grpc?go-get=1": Get http://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:80: i/o timeout

ProjectRoot name validation failed

最新的 Readme 是不是编译步骤漏掉了?

按照之前版本的 Readme 来编译会报错,最后通过执行 dep ensuremake install 就可以了。
现在按照最新的 Readme 来编译,执行 make install 还是报错,不知道什么原因?

cd im && make go build -ldflags "-X main.VERSION=2.0.0 -X 'main.BUILD_TIME=date' -X 'main.GO_VERSION=go version' -X 'main.GIT_COMMIT_ID=git log --pretty=format:"%h" -1' -X 'main.GIT_BRANCH=git rev-parse --abbrev-ref HEAD'" im.go subscriber.go connection.go client.go peer_client.go group_client.go room_client.go customer_client.go route.go app_route.go protocol.go message.go group_manager.go group.go set.go config.go monitoring.go sio.go storage_rpc.go channel.go storage_message.go route_message.go user.go rpc.go dummy_grpc.go device.go group_message_deliver.go command-line-arguments ./sio.go:93:28: undefined: engineio.MessageBinary ./sio.go:117:10: undefined: engineio.MessageText make[1]: *** [im] Error 2 make: *** [im_bin] Error 2

gRPC.go编译错误

func (s *RPCServer) LoadHistoryMessage(ctx context.Context, r *pb.LoadHistoryRequest) (*pb.HistoryMessage, error) {
appid := r.Appid
uid := r.Uid
msgid := r.LastId

storage_pool := GetStorageConnPool(uid)

GetStorageConnPool无实现函数

依赖的包文件没有实现的方法

google.golang.org/grpc/internal/transport
../../google.golang.org/grpc/internal/transport/handler_server.go:221:12: undefined: http2.TrailerPrefix
../../google.golang.org/grpc/internal/transport/http2_client.go:632:20: f.Size undefined (type hpack.HeaderField has no field or method Size)
../../google.golang.org/grpc/internal/transport/http2_client.go:1138:45: undefined: http2.MetaHeadersFrame
../../google.golang.org/grpc/internal/transport/http2_client.go:1251:24: t.framer.fr.ErrorDetail undefined (type *http2.Framer has no field or method ErrorDetail)
../../google.golang.org/grpc/internal/transport/http2_client.go:1262:9: undefined: http2.MetaHeadersFrame
../../google.golang.org/grpc/internal/transport/http2_server.go:287:45: undefined: http2.MetaHeadersFrame
../../google.golang.org/grpc/internal/transport/http2_server.go:460:9: undefined: http2.MetaHeadersFrame
../../google.golang.org/grpc/internal/transport/http2_server.go:731:19: f.Size undefined (type hpack.HeaderField has no field or method Size)
../../google.golang.org/grpc/internal/transport/http_util.go:262:43: undefined: http2.MetaHeadersFrame
../../google.golang.org/grpc/internal/transport/http_util.go:672:6: f.fr.SetReuseFrames undefined (type *http2.Framer has no field or method SetReuseFrames)
../../google.golang.org/grpc/internal/transport/http_util.go:672:6: too many errors

是否可以支持语音

刚开始接触im_server想问一下,这个是否支持语音消息发送,类似微信语音功能

单聊消息同步问题

注意到在IM实例处理client发来的 MSG_IM时会同时投递 MSG_IMMSG_SYNC_NOTIFY 至接收方和client其他登陆点,目的似乎是为了保证各消息接收点的消息时序一致性,在这里既发送MSG_IM 又发送 MSG_SYNC_NOTIFY的方式是否显得冗余:
1、IM实例处理 MSG_IM 时是否可以仅发送MSG_IM,让接收消息的终端自己根据msgid判断是否向服务器同步消息
2、IM实例处理 MSG_IM 时是否可以仅发送MSG_SYNC_NOTIFY,让接收消息的终端自己主动向服务器拉取具体消息
这样似乎可以减少服务器处理消息的压力,请教

meta := &Metadata{sync_key:msgid, prev_sync_key:prev_msgid}
m1 := &Message{cmd:MSG_IM, version:DEFAULT_VERSION, flag:message.flag|MESSAGE_FLAG_PUSH, body:msg, meta:meta}
client.SendMessage(msg.receiver, m1)
notify := &Message{cmd:MSG_SYNC_NOTIFY, body:&SyncKey{msgid}}
client.SendMessage(msg.receiver, notify)
//发送给自己的其它登录点
meta = &Metadata{sync_key:msgid2, prev_sync_key:prev_msgid2}
m2 := &Message{cmd:MSG_IM, version:DEFAULT_VERSION, flag:message.flag|MESSAGE_FLAG_PUSH, body:msg, meta:meta}
client.SendMessage(client.uid, m2)
notify = &Message{cmd:MSG_SYNC_NOTIFY, body:&SyncKey{msgid}}
client.SendMessage(client.uid, notify)

请教大神几个问题

1)im,imr,ims,lru几个目录简单说明,从名字不容易看出来
2)im_sevice目录下的多个文件,与im,imr,ims目录里面都有重复的,为什么不放进去?
3)还继续更新吗?

重复消息

安卓客户端偶尔发送连续重复消息,但是前端只显示一条,后端会收到多条一样的消息落库

Hello,麻烦问一下服务器端为什么选择go语言呢?

您好,
我一直在研究IM服务端开发这块,我看有一些人选择了C++进行开发,麻烦问一下你们为啥选择了go语言呢?请问一下除了这个选择之外,还有别的语言或者框架推荐一下的吗?谢谢

I suggest add a vendor dir

Golang you must go get a lot of package.But It's not so good in China. So, As k8s project, you can use godep save to keep all dependence in vendor dir. You no longer need to hand download other package.

make install sio.go:93:28: undefined: engineio.MessageBinary

make install
cd im && make
make[1]: Entering directory /root/go/im_service/im' go build -ldflags "-X main.VERSION=2.0.0 -X 'main.BUILD_TIME=date' -X 'main.GO_VERSION=go version' -X 'main.GIT_COMMIT_ID=git log --pretty=format:"%h" -1' -X 'main.GIT_BRANCH=git rev-parse --abbrev-ref HEAD`'" -o im im_server.go im.go subscriber.go connection.go client.go peer_client.go group_client.go room_client.go customer_client.go route.go app_route.go protocol.go message.go group_manager.go group.go set.go config.go monitoring.go sio.go storage_rpc.go channel.go storage_message.go route_message.go user.go rpc.go dummy_grpc.go device.go group_message_deliver.go relationship.go relationship_pool.go redis_channel.go

command-line-arguments

./sio.go:93:28: undefined: engineio.MessageBinary
./sio.go:117:10: undefined: engineio.MessageText
make[1]: *** [im] Error 2
make[1]: Leaving directory `/root/go/im_service/im'

go version go1.13 linux/amd64

what`s the problem ? buddy

message seq problem

message seq is inited in the below function, it's not global variable, and I don't see any function loading this one, so, when one client is offline and online again, the seq will always begin from 0?

func (client *Client) Write() {

我在上面的函数里面看到有初始化seq的地方,但没有看到任何地方对它进行持久化,那么,客户端再次连接进来之后,seq岂不是依然从0开始?

看文档不是这么说的,文档说客户端连接后,可以从某个seq位置来取消息,类似于断点续传?

我执行 make install 报错

我在墙内,没办法通过 dep ensure 解决依赖,我将所有的依赖包都从github下载到了本地,但是在执行 make install 的时候报错。 报错如下:

make install
cd im && make
make[1]: 进入目录“/usr/local/golang/src/github.com/GoBelieveIO/im_service/im”
go build -ldflags "-X main.VERSION=2.0.0 -X 'main.BUILD_TIME=date' -X 'main.GO_VERSION=go version' -X 'main.GIT_COMMIT_ID=git log --pretty=format:"%h" -1' -X 'main.GIT_BRANCH=git rev-parse --abbrev-ref HEAD'" -o im im_server.go im.go subscriber.go connection.go client.go peer_client.go group_client.go room_client.go customer_client.go route.go app_route.go protocol.go message.go group_manager.go group.go set.go config.go monitoring.go sio.go storage_rpc.go channel.go storage_message.go route_message.go user.go rpc.go dummy_grpc.go device.go group_message_deliver.go relationship.go relationship_pool.go

command-line-arguments

./sio.go:93:28: undefined: engineio.MessageBinary
./sio.go:117:10: undefined: engineio.MessageText
make[1]: *** [im] 错误 2
make[1]: 离开目录“/usr/local/golang/src/github.com/GoBelieveIO/im_service/im”
make: *** [im_bin] 错误 2

mysqldb_appsource non exist

1.im.cfg.sample 里没有相关的配置项
2.make 出来的应用没有im_api 与readme 文档对应不上

make install报错

cd im && make
make[1]: 进入目录“/home/develkone/go/src/im_service/im”
go test -c  im_test.go user.go relationship.go relationship_pool.go protocol.go message.go config.go
# command-line-arguments
./relationship_pool.go:238:3: Info call has possible formatting directive %+v
./relationship_pool.go:253:3: Info call has possible formatting directive %+v
Makefile:29: recipe for target 'main.test' failed
make[1]: *** [main.test] Error 2
make[1]: 离开目录“/home/develkone/go/src/im_service/im”
Makefile:5: recipe for target 'im_bin' failed
make: *** [im_bin] Error 2

BUG

代码内函数重复冲突。。

make install error

cd im && make
go build -ldflags "-X main.VERSION=2.0.0 -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_COMMIT_ID=`git log --pretty=format:"%h" -1`' -X 'main.GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`'" im.go subscriber.go connection.go client.go peer_client.go group_client.go room_client.go customer_client.go route.go app_route.go protocol.go message.go group_manager.go group.go set.go config.go monitoring.go sio.go storage_rpc.go channel.go storage_message.go route_message.go user.go rpc.go dummy_grpc.go device.go group_message_deliver.go
# command-line-arguments
./sio.go:90:28: undefined: engineio.BINARY
./sio.go:114:10: undefined: engineio.TEXT
make[1]: *** [im] Error 2
make: *** [im_bin] Error 2

It show error at masOS 10.14.

undefined: cloneTLSConfig

when I perform"go get github.com/go-sql-driver/mysql"
,I got an error " /golib/src/github.com/go-sql-driver/mysql/utils.go:81: undefined: cloneTLSConfig"

是否缺少api server代码?

我看到readme文件不久前删除了./im_api api.cfg,而且之前也找不到im_api相关的编译规则,是不是这块代码没上传?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.