openimsdk / oimws Goto Github PK
View Code? Open in Web Editor NEWA websocket and tcp framework for openim
License: MIT License
A websocket and tcp framework for openim
License: MIT License
in makefile,make start not have daemon
## start: Start the service. .PHONY: start start: @$(BIN_DIR)/$(BINS)/main
add Cluster solution for oimws.use Consistent Hashing solution.
Status | Count |
---|---|
🔍 Total | 11 |
✅ Successful | 10 |
⏳ Timeouts | 0 |
🔀 Redirected | 0 |
👻 Excluded | 0 |
❓ Unknown | 0 |
🚫 Errors | 1 |
Status | Count |
---|---|
🔍 Total | 11 |
✅ Successful | 10 |
⏳ Timeouts | 0 |
🔀 Redirected | 0 |
👻 Excluded | 0 |
❓ Unknown | 0 |
🚫 Errors | 1 |
2024-01-24 10:27:56.685 DEBUG [PID:17846] [open_im_sdk/userRelated.go:428] TriggerCmdLogout server recycle resources success... {"operationID": "socket close"}
2024-01-24 10:27:56.685 DEBUG [PID:17846] [open_im_sdk/userRelated.go:435] TriggerCmdLogout client success... {"operationID": "socket close", "isTokenValid": false}
2024-01-24 10:27:56.685 INFO [PID:17846] [interaction/msg_sync.go:107] msg syncer done, sdk logout..... {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.685 INFO [PID:17846] [interaction/long_conn_mgr.go:288] heartbeat done sdk logout..... {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.685 WARN [PID:17846] [interaction/long_conn_mgr.go:283] heartbeat closed {"operationID": "1706063239423036851", "heartbeat": "heartbeat done sdk logout....."}
2024-01-24 10:27:56.685 INFO [PID:17846] [common/trigger_channel.go:214] conversation done sdk logout.....
2024-01-24 10:27:56.685 INFO [PID:17846] [open_im_sdk/userRelated.go:255] logoutListener done sdk logout..... {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.696 ERROR [PID:17846] [db/chat_log_model_v3.go:38] create table seq index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "sql: database is closed"}
2024-01-24 10:27:56.696 ERROR [PID:17846] [db/chat_log_model_v3.go:43] create table send_time index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "sql: database is closed"}
2024-01-24 10:27:56.696 ERROR [PID:17846] [interaction/msg_sync.go:82] get group normal seq failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.697 ERROR [PID:17846] [db/chat_log_model_v3.go:38] create table seq index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "sql: database is closed"}
2024-01-24 10:27:56.697 ERROR [PID:17846] [db/chat_log_model_v3.go:43] create table send_time index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "sql: database is closed"}
2024-01-24 10:27:56.697 ERROR [PID:17846] [interaction/msg_sync.go:82] get group normal seq failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.697 ERROR [PID:17846] [db/chat_log_model_v3.go:38] create table seq index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "sql: database is closed"}
2024-01-24 10:27:56.699 ERROR [PID:17846] [db/chat_log_model_v3.go:43] create table send_time index failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "sql: database is closed"}
2024-01-24 10:27:56.699 ERROR [PID:17846] [interaction/msg_sync.go:82] get group normal seq failed {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.699 ERROR [PID:17846] [interaction/msg_sync.go:89] get notification seq failed {"operationID": "ijpw2wbn81706063276370", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetNotificationAllSeqs()@43: GetNotificationAllSeqs failed: sql: database is closed"}
2024-01-24 10:27:56.699 ERROR [PID:17846] [interaction/msg_sync.go:63] loadSeq err {"operationID": "ijpw2wbn81706063276370", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetNotificationAllSeqs()@43: GetNotificationAllSeqs failed: sql: database is closed"}
2024-01-24 10:27:56.699 DEBUG [PID:17846] [open_im_sdk/userRelated.go:354] login success... {"operationID": "ijpw2wbn81706063276370", "login cost time: ": 0.01426576}
2024-01-24 10:27:56.699 DEBUG [PID:17846] [interaction/long_conn_mgr.go:279] heartbeat start {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166435}
2024-01-24 10:27:56.699 DEBUG [PID:17846] [interaction/long_conn_mgr.go:171] readPump start {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166401}
2024-01-24 10:27:56.699 DEBUG [PID:17846] [interaction/long_conn_mgr.go:499] conn start {"operationID": "1706063280061962243"}
2024-01-24 10:27:56.699 DEBUG [PID:17846] [interaction/long_conn_mgr.go:231] writePump start {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166434}
2024-01-24 10:27:56.700 INFO [PID:17846] [interaction/long_conn_mgr.go:554] long conn establish success {"operationID": "1706063280061962243", "localAddr": "127.0.0.1:48510", "connNum": 1}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb168de]
goroutine 166436 [running]:
github.com/openimsdk/openim-sdk-core/v3/internal/interaction.(*MsgSyncer).DoListener(0x0, {0xfdb580, 0xc0005400c0})
/root/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/internal/interaction/msg_sync.go:104 +0xbe
created by github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(*LoginMgr).run
/root/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/open_im_sdk/userRelated.go:377 +0xae
make: *** [start] Error 2
以上是截取了部分日志,日志上面有 ERROR 错误。供参考!
[oimws.log](https://github.com/openim-sigs/oimws/files/14033627/oimws.log)
2024-03-07 11:31:23.750 �[34mINFO�[0m �[34m[PID:44674]�[0m [core_func/ws_handler.go:289] input req {"operationID": "4p8wmpcyhe1709782283749", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(*Conversation).SendMessageNotOss-fm", "args": ["{\"clientMsgID\":\"e0691b46b6b22301722e262aa5dfbdb1\",\"createTime\":1709782283728,\"sendTime\":1709782283728,\"sessionType\":0,\"sendID\":\"5706937089\",\"msgFrom\":100,\"contentType\":101,\"senderPlatformID\":5,\"senderNickname\":\"饭盒1\",\"seq\":0,\"isRead\":false,\"status\":1,\"textElem\":{\"content\":\"11212\"}}","","3578134225","{\"title\":\"you have a new message\",\"desc\":\"you have a new message\",\"ex\":\"\",\"iOSPushSound\":\"\",\"iOSBadgeCount\":true}"]} [2024-03-07 11:31:23.751] [eror] [responder.go:31] msg="sendOnErrorResp" operationID="4p8wmpcyhe1709782283749" event="SendMessageNotOss" err="go code error: fn in args num is not match: 10006 SdkInternalError"
小程序端有问题 其他还ok~ 求救
Status | Count |
---|---|
🔍 Total | 11 |
✅ Successful | 10 |
⏳ Timeouts | 0 |
🔀 Redirected | 0 |
👻 Excluded | 0 |
❓ Unknown | 0 |
🚫 Errors | 1 |
I am currently using oimws for tag 3.5.0 to report this error, using the previous version of tag can automatically generate the database. But using https://github.com/openim-sigs/oimws.git directly pull does not automatically generate database.
oimws3.5.0.log
After starting the oimws service, the connection to port 10003 still failed. Checking the mage log, the full text is as follows:
EROR [2024-06-12 09:24:19.210] [responder.go:31] msg="sendOnErrorResp" operationID="gmm9kk5be31718155459046" event="Login" err="init database ==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.NewDataBase()@88: initDB failed _output/db: ==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).initDB()@116: open db failed /root/oimws/_output/bin/platforms/linux/arm64/_output/db/OpenIM_v3_252817.db: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub: 10006 SdkInternalError"
This issue is due to the 'CGO_ENABLED=0' setting in go env.
Solution:
Enter the following commands in the terminal:
export CGO_ENABLED=1
apt-get update
apt-get install gcc
Check with:
go env | grep CGO_ENABLED
mage
mage start
I hope this issue can help everyone.
仓库的指导文档跑起来太麻烦了,献丑写了个Docker镜像构建文件,方便运行哈哈哈
最终构建出来的镜像文件只有30多M
# 使用官方的 Golang Alpine 镜像作为基础镜像进行构建
FROM golang:1.21.2-alpine AS builder
MAINTAINER zyq [email protected]
# 设置环境变量
ENV GO111MODULE=on \
GOPROXY=https://proxy.golang.org,direct \
#启用cgo 制品依赖sqlite3需要
CGO_ENABLED=1
# 更换依赖源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装必要的依赖和工具
RUN apk update && apk add --no-cache git gcc musl-dev
# 安装mage编译工具
RUN go install github.com/magefile/mage@latest
# 设置工作目录
WORKDIR /app
# 将本地代码复制到容器中
COPY . .
# 构建项目,生成 mage 文件
RUN mage
FROM alpine:latest
# 设置工作目录
WORKDIR /app
RUN mkdir /app/config
# 复制运行配置文件到工作目录
COPY --from=builder /app/config /app/config
#复制编译后制品,不同环境肯能存在不同的构建路径
COPY --from=builder /app/_output/bin/platforms/linux/amd64/openim-sdk /usr/local/bin
# 暴露端口
EXPOSE 10003
# 运行
CMD ["openim-sdk","-c","/app/config"]
No response
When oimws obtains a token from the request header "Authorization" when the websocket protocol is upgraded, the token is spliced behind the URL when logging in to the jssdk, resulting in oimws not being able to obtain the token and printing the error message "http的headers Authorization中没有对应token", and the jssdk cannot be logged in normally. Currently, you can obtain the token parameter in the url through the nginx proxy and add an Authorization request header to complete the jssdk login.
Start with mage uniformly and replace the original make
The iOS version of the mini-program has a problem. When user A switches the mini-program to the background and receives a message from user B, upon returning to the app, A can only see a notification for the unread message. However, clicking on it doesn't display the actual message, and even after refreshing, the message remains invisible. Only when either A or B initiates another message, the previously lost message becomes visible again.
Interestingly, this issue does not occur in the same scenario on the Android version.
oimws更新了3.5.1-beta.1版本,微信小程序端,正常登录和退出,对方看到的在线状态是正确的,如果是切掉进程或者息屏,对方看到的状态就不对了,仍然是在线。然后对方息屏后再打开手机,这时对方本应该看到是在线状态,却变成了离线了。
2024-01-24 10:14:22.952 ERROR [PID:26443] [interaction/msg_sync.go:73] get conversation id list failed {"operationID": "prgpqt8hz1706062461295", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetAllConversationIDList()@78: GetAllConversationIDList failed : sql: database is closed"}
2024-01-24 10:14:22.952 ERROR [PID:26443] [interaction/msg_sync.go:63] loadSeq err {"operationID": "prgpqt8hz1706062461295", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetAllConversationIDList()@78: GetAllConversationIDList failed : sql: database is closed"}
2024-01-24 10:14:22.952 DEBUG [PID:26443] [open_im_sdk/userRelated.go:354] login success... {"operationID": "prgpqt8hz1706062461295", "login cost time: ": 0.000692208}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x100fb6410]
goroutine 25467 [running]:
github.com/openimsdk/openim-sdk-core/v3/internal/interaction.(*MsgSyncer).DoListener(0x0, {0x1014af980, 0x14000902ed0})
/Users/zhanghui/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/internal/interaction/msg_sync.go:104 +0x70
created by github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(*LoginMgr).run in goroutine 25306
/Users/zhanghui/go/pkg/mod/github.com/openimsdk/openim-s
Status | Count |
---|---|
🔍 Total | 11 |
✅ Successful | 10 |
⏳ Timeouts | 0 |
🔀 Redirected | 0 |
👻 Excluded | 0 |
❓ Unknown | 0 |
🚫 Errors | 1 |
No response received for the message, when get all conversationlist.
On the mini-program side, when a user is offline, there are two scenarios:
If the other party didn't log out properly but merely switched to the background, causing a disconnection, I send them a message. However, when the other party switches back to the foreground, they cannot receive the offline message I just sent. At this point, there is a record in MongoDB, but there is no record in SQLite.
When a user performs a normal account logout, I send them a message. After the other party successfully logs in, they will receive the offline message.
使用同一个userID+2个不同的platformID, 获得到2个不同的token, 在2个浏览器窗口分别使用这些token登录, 并监听新消息(IMSDK.on(CbEvents.OnRecvNewMessages)
), 会概率性出现 其中一个窗口监听不到新消息
两个窗口都能正常使用
上面的视频是同一个用户同时打开两个浏览器聊天窗口的情况, 只有一个窗口能正常收到消息,另外一个H5窗口收不到消息,或者消息有丢失
Status | Count |
---|---|
🔍 Total | 11 |
✅ Successful | 10 |
⏳ Timeouts | 0 |
🔀 Redirected | 0 |
👻 Excluded | 0 |
❓ Unknown | 0 |
🚫 Errors | 1 |
error *errors.withstack not implement CodeError: init database ==)github.com/openimsdk/openim-sdk-core/v3/pkg/db,NewDataBase()0107: initDB failed ./db;==>core/v3/pkg/db.(*DataBase).initDB()@138: open db failed /Users/zhanghui/Project/openim-10006 SdkInternalError
github.com/openimsdk/openim-sdk-
docker/oimws/db/0penIM v3 5aba2dce8afe4eb8a5eb468d185515dd.db: unable to open database file: no such file or directory:
1、h5项目里,建议明确说明需要安装oimws服务,最好在界面里提示
2、需要手动创建db目录才能正常运行(openIMDbDir )
3、没有上面链接所说的./example, 链接应该用make start 或bin/main 替代 https://docs.openim.io/zh-Hans/guides/gettingStarted/jssdk
4、make start后不能后台
3.7.1
Linux (AMD)
Source Code Deployment
版本 commit: ea4d8b6
未读消息的数目显示不正确,并且当成功发起调用请求,设置会话为已读后,消息数目不能清除,依然保持原来的数目。排查代码 openim-sdk-core/[email protected]/internal/conversation_msg/read_drawing.go: 142 发现是先获取未读消息列表,然后再清空消息计数表。但是如果未读消息列表为空的时候,就直接返回了,这时候可能计数表大于0(由于某些原因造成的不一致),除非接收到新的未读消息,否则清空计数表的代码不可到达,永远无法清零。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.