订阅会话更新

这个提交包含在:
xuqm 2023-06-02 17:58:18 +08:00
父节点 5d1be59ed2
当前提交 01cbe38e6e
共有 3 个文件被更改,包括 10 次插入2 次删除

查看文件

@ -7,6 +7,7 @@ public enum PacketType {
//发送消息
SEND(20),
SEND_ACK(21),
CONVERSATION(30),
//心跳包
PING(40),
PANG(41),

查看文件

@ -51,6 +51,7 @@ public class ImManager implements IMInterface {
// 新消息到达
private String topic_arrive;
private String topic_conversation;
// 发送消息应答
private String topic_send_ack;
@ -102,6 +103,7 @@ public class ImManager implements IMInterface {
topic_send_ack = Constant.getSdkAppID() + "/" + PacketType.SEND_ACK + Constant.getUserId();
topic_connected = Constant.getSdkAppID() + "/" + PacketType.CONNECTED + Constant.getUserId();
topic_arrive = Constant.getSdkAppID() + "/" + PacketType.SEND + Constant.getUserId();
topic_conversation = Constant.getSdkAppID() + "/" + PacketType.CONVERSATION + Constant.getUserId();
topic_pang = Constant.getSdkAppID() + "/" + PacketType.PANG + Constant.getUserId();
topic_result = Constant.getSdkAppID() + "/" + PacketType.RESULT + Constant.getUserId();
topic_system = Constant.getSdkAppID() + "/" + PacketType.SYSTEM + Constant.getUserId();
@ -136,6 +138,7 @@ public class ImManager implements IMInterface {
mqttClient.subscribe(topic_pang, 2);
mqttClient.subscribe(topic_result, 2);
mqttClient.subscribe(topic_system, 2);
mqttClient.subscribe(topic_conversation, 2);
Log.e("======>connectComplete", topic_send_ack);
} catch (MqttException e) {
Log.e(TAG, "=====>connectComplete", e);
@ -184,6 +187,10 @@ public class ImManager implements IMInterface {
handler.sendMessage(m);
}
// 会话更新
else if (topic.equals(topic_conversation)) {
Log.d("======>会话列表更新", topic + "::\n" + msg);
}
// 新消息送达
else if (topic.equals(topic_arrive)) {
SZYXMessage szyxMessage = GsonImplHelp.get().toObject(msg, SZYXMessage.class);
@ -197,7 +204,7 @@ public class ImManager implements IMInterface {
});
}
} else
Log.e("======>messageArrived", topic + "::" + msg);
Log.e("======>未知消息", topic + "::" + msg);
}

查看文件

@ -11,7 +11,7 @@ public class GroupVM extends BaseListViewModel<UserItem> {
private final ArrayList<UserItem> list = new ArrayList<UserItem>() {
{
add(new UserItem("ce91ad9b-ba88-4e21-a868-d8fb0842a55f", "Android应用", "https://i.buyiju.com/img/zidian2/766.jpg", ""));
add(new UserItem("1855c123-5997-4c92-906c-d25c84a6a97d", "Android应用", "https://i.buyiju.com/img/zidian2/766.jpg", ""));
}
};