openimsdk / open-im-android-demo

IM Android
https://openim.io
94 stars 90 forks source link

[BUG] The message parsed from sdk is null #40

Closed GeminiR closed 1 month ago

GeminiR commented 1 month ago

OpenIM Server Version

io.openim:android-sdk:3.5.1-beta1@aar io.openim:core-sdk:3.5.1@aar

Operating System and CPU Architecture

macOS (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

不管是发送文本消息,还是图片,或者拍照,在通过OpenIMClient.getInstance().messageManager对象的消息包装之后,得到的都为 null,如图所示,传入的文本是有值的,但是 sdk 获取到的消息为 null。 211726815009_ pic

Screenshots Link

No response

GeminiR commented 1 month ago

我当前的登录状态通过 SDK 拿到的loginStatus 是 3 也就是 logged,但是初始化时的 connectionListener 一直回调连接服务器,也不会报错失败,也不会成功,所以这是登录成功了还是失败了?

GeminiR commented 1 month ago

OpenIMClient.getInstance().login 登录成功之后的日志:

15:25:09.640 I 2024-09-23 07:25:09.639 INFO [PID:7758] [open_im_sdk/caller.go:115] func call req {"operationID": "1727076309639", "function name": "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(LoginMgr).Login-fm", "args": ["D2101935402","Bearer cd3e35d2-0da1-42f0-b271-fa89d27fb28e"]} 15:25:09.640 I 2024-09-23 07:25:09.640 INFO [PID:7758] [db/db_init.go:106] sqlite {"operationID": "1727076309639", "path": "/data/user/0/com.imile.imbusinesskit.example/files/OpenIM_v3_D2101935402.db"} 15:25:09.650 I 2024-09-23 07:25:09.648 DEBUG [PID:7758] [db/db_init.go:118] open db success {"operationID": "1727076309639", "dbError": "json: unsupported type: func() time.Time", "dbFileName": "/data/user/0/com.imile.imbusinesskit.example/files/OpenIM_v3_D2101935402.db"} 15:25:09.678 I 2024-09-23 07:25:09.678 INFO [PID:7758] [open_im_sdk/caller.go:107] fn call success {"operationID": "1727076309639", "function name": "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(LoginMgr).Login-fm", "resp": "", "cost time": "39 ms"}

在发送消息时日志会有找不到用户消息的信息。 15:44:42.494 I 2024-09-23 07:44:42.493 INFO [PID:11377] [open_im_sdk/caller.go:115] func call req {"operationID": "1727077482492", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "args": ["D21013860",""]} 15:44:42.496 I 2024-09-23 07:44:42.495 ERROR [PID:11377] [open_im_sdk/caller.go:109] fn call error {"operationID": "1727077482492", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "cost time": "2 ms", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(DataBase).GetLoginUser()@31: GetLoginUserInfo failed: record not found"} 15:44:42.678 I 2024-09-23 07:44:42.677 INFO [PID:11377] [open_im_sdk/caller.go:115] func call req {"operationID": "1727077482677", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "args": ["D21013860",""]} 15:44:42.679 I 2024-09-23 07:44:42.679 ERROR [PID:11377] [open_im_sdk/caller.go:109] fn call error {"operationID": "1727077482677", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "cost time": "1 ms", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(DataBase).GetLoginUser()@31: GetLoginUserInfo failed: record not found"} 15:44:42.701 I 2024-09-23 07:44:42.696 INFO [PID:11377] [open_im_sdk/caller.go:115] func call req {"operationID": "1727077482696", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "args": ["D21013860",""]} 15:44:42.703 I 2024-09-23 07:44:42.702 ERROR [PID:11377] [open_im_sdk/caller.go:109] fn call error {"operationID": "1727077482696", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).TypingStatusUpdate-fm", "cost time": "5 ms", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(DataBase).GetLoginUser()@31: GetLoginUserInfo failed: record not found"} 15:44:44.639 I 2024-09-23 07:44:44.637 INFO [PID:11377] [open_im_sdk/caller.go:265] func call req {"operationID": "1727077484635", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).CreateTextMessage-fm", "args": ["121"]} 15:44:44.639 I 2024-09-23 07:44:44.639 ERROR [PID:11377] [open_im_sdk/caller.go:260] fn call error {"operationID": "1727077484635", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(Conversation).CreateTextMessage-fm", "cost time": "2 ms", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(DataBase).GetLoginUser()@31: GetLoginUserInfo failed: record not found"}

GeminiR commented 1 month ago

经过确认还是 token 出现问题导致ws服务器一直在连接,不过还是不明白,我们服务端的 token 格式都是 Bearer xxx,但是就是不成功,去掉中间的空格反而成功了,因为内部都封装好了,所以无法 debug ,所以也不知道我们 sdk 内部是怎么处理 token 与服务端交互的。