增加了长连接数据接受
This commit is contained in:
@@ -4,13 +4,14 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.MsgBody;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
|
||||
/**
|
||||
* Socket常链接工具类
|
||||
*/
|
||||
public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
|
||||
public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener, IMogoCloudSocketOnMessageListener {
|
||||
private static final String TAG = "SocketMsgUtils";
|
||||
|
||||
private static final String appId = "liveStream";
|
||||
@@ -43,6 +44,7 @@ public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
|
||||
private void initSocket() {
|
||||
mSocketManager = SocketManager.getInstance();
|
||||
mSocketManager.init(mContext);
|
||||
mSocketManager.registerOnMessageListener(401016, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,4 +68,14 @@ public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
|
||||
Log.i(TAG, "msgId=" + msgId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class target() {
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(Object obj) {
|
||||
Log.i(TAG, "onMsgReceived: obj=" + obj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user