fix bug of convert msgBody
This commit is contained in:
@@ -23,7 +23,7 @@ public class MsgBody {
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private Object mContent;
|
||||
private byte[] mContent;
|
||||
|
||||
public MsgBody msgType(int msgType) {
|
||||
this.mMsgType = msgType;
|
||||
@@ -35,7 +35,7 @@ public class MsgBody {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody content(Object object) {
|
||||
public MsgBody content(byte[] object) {
|
||||
this.mContent = object;
|
||||
return this;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class MsgBody {
|
||||
return mMsgId;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
public byte[] getContent() {
|
||||
return mContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class SocketManager implements IMogoCloudSocketManager, Callback {
|
||||
@Override
|
||||
public void sendMsg(String appId, int headerType, MsgBody body, IMogoCloudSocketMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg msgId : " + body.getMsgId());
|
||||
final byte[] pb = convertToPBBytes(body.getMsgType(), (byte[])body.getContent());
|
||||
final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent());
|
||||
SocketClient.getInstance().sendData(appId, MogoCommon.Product.mogoBussiness.getNumber(), pb, headerType, true, body.getMsgId());
|
||||
mAckListeners.put(body.getMsgId(), listener);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class SocketHandler {
|
||||
}
|
||||
MsgBody msgBody = new MsgBody();
|
||||
msgBody.msgType(msgType);
|
||||
msgBody.content(msg);
|
||||
msgBody.content(msg.getBytes());
|
||||
SocketManager.getInstance().sendMsg(mAppId, HEADER_TYPE, msgBody, msgId -> {
|
||||
for (IMogoCloudOnMsgListener listener : onMsgListenerList) {
|
||||
if (listener != null) {
|
||||
|
||||
Reference in New Issue
Block a user