The root of the issue is a bug in the mini-program side when calling OIMWS, but after reviewing the code, the core implementation was found in openim-sdk-core. The number of unread messages is displayed incorrectly, and even after successfully making a call to set the conversation as read, the message count does not reset and remains unchanged. Upon investigating the code at openim-sdk-core/v3@v3.5.1/internal/conversation_msg/read_drawing.go: 142, it was discovered that the unread message list is retrieved first, and then the message count table is cleared. However, if the unread message list is empty, it directly returns, and at this time, the count table might still be greater than zero (due to some inconsistencies). Unless a new unread message is received, the code to clear the count table is unreachable, and the count can never be reset to zero.
Suggestion: Execute the subsequent code regardless of whether the SQLite message table's unread messages are empty or not; do not return prematurely.
The OIMWS will be phased out, and a new JavaScript SDK is currently under development. This upcoming SDK promises more advanced features and improved performance
OpenIM Server Version
3.7.1
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
The root of the issue is a bug in the mini-program side when calling OIMWS, but after reviewing the code, the core implementation was found in openim-sdk-core. The number of unread messages is displayed incorrectly, and even after successfully making a call to set the conversation as read, the message count does not reset and remains unchanged. Upon investigating the code at openim-sdk-core/v3@v3.5.1/internal/conversation_msg/read_drawing.go: 142, it was discovered that the unread message list is retrieved first, and then the message count table is cleared. However, if the unread message list is empty, it directly returns, and at this time, the count table might still be greater than zero (due to some inconsistencies). Unless a new unread message is received, the code to clear the count table is unreachable, and the count can never be reset to zero.
Suggestion: Execute the subsequent code regardless of whether the SQLite message table's unread messages are empty or not; do not return prematurely.
Screenshots Link
相关代码:
前端调用 markConversationMessageAsRead, 服务端 oimws 产生的日志:
local db 消息表:
local db 会话表: