默认关掉设备在线状态回调
This commit is contained in:
@@ -133,7 +133,7 @@ push.ios.server.address http://localhost:8085/ios/push
|
||||
# User online status event callback
|
||||
#*********************************************************************
|
||||
##用户在线状态事件回调地址
|
||||
user.online_status_callback http://localhost:8888/user/online_event
|
||||
#user.online_status_callback http://localhost:8888/user/online_event
|
||||
|
||||
#*********************************************************************
|
||||
# MongoDB configuration
|
||||
|
||||
@@ -18,6 +18,7 @@ package io.moquette.spi.impl;
|
||||
|
||||
import cn.wildfirechat.common.ErrorCode;
|
||||
import cn.wildfirechat.pojos.SendMessageData;
|
||||
import cn.wildfirechat.pojos.UserOnlineStatus;
|
||||
import cn.wildfirechat.proto.ProtoConstants;
|
||||
import cn.wildfirechat.proto.WFCMessage;
|
||||
import com.google.gson.Gson;
|
||||
@@ -256,25 +257,6 @@ public class ProtocolProcessor {
|
||||
LOG.info("The CONNECT message has been processed. CId={}, username={}", clientId, payload.userName());
|
||||
}
|
||||
|
||||
private static class UserOnlineStatus {
|
||||
public static final int ONLINE = 0;
|
||||
public static final int OFFLINE = 1;
|
||||
public static final int LOGOUT = -1;
|
||||
public String userId;
|
||||
public String clientId;
|
||||
public int platform;
|
||||
public int status;
|
||||
public long timestamp;
|
||||
|
||||
public UserOnlineStatus(String userId, String clientId, int platform, int status) {
|
||||
this.userId = userId;
|
||||
this.clientId = clientId;
|
||||
this.platform = platform;
|
||||
this.status = status;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
public void forwardOnlineStatusEvent(String userId, String clientId, int platform, int status) {
|
||||
if (!StringUtil.isNullOrEmpty(mUserOnlineStatusCallback)) {
|
||||
executorCallback.execute(() -> HttpUtils.httpJsonPost(mUserOnlineStatusCallback, new Gson().toJson(new UserOnlineStatus(userId, clientId, platform, status))));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
public class UserOnlineStatus {
|
||||
public static final int ONLINE = 0;
|
||||
public static final int OFFLINE = 1;
|
||||
public static final int LOGOUT = -1;
|
||||
public String userId;
|
||||
public String clientId;
|
||||
public int platform;
|
||||
public int status;
|
||||
public long timestamp;
|
||||
|
||||
public UserOnlineStatus(String userId, String clientId, int platform, int status) {
|
||||
this.userId = userId;
|
||||
this.clientId = clientId;
|
||||
this.platform = platform;
|
||||
this.status = status;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ push.ios.server.address http://localhost:8085/ios/push
|
||||
# User online status event callback
|
||||
#*********************************************************************
|
||||
##用户在线状态事件回调地址
|
||||
user.online_status_callback http://localhost:8888/user/online_event
|
||||
#user.online_status_callback http://localhost:8888/user/online_event
|
||||
|
||||
|
||||
#*********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user