|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|
|
import org.msgpack.core.MessageBufferPacker;
|
|
|
import org.msgpack.core.MessagePack;
|
|
|
import org.msgpack.core.MessageUnpacker;
|
|
|
+import org.msgpack.core.buffer.MessageBuffer;
|
|
|
import org.msgpack.value.ValueType;
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
@@ -156,7 +157,7 @@ public abstract class MsgBase {
|
|
|
/**
|
|
|
* 将 WSResponse 序列化为字节数组
|
|
|
*/
|
|
|
- public byte[] toBytes() throws Exception {
|
|
|
+ public MessageBuffer toBytes() throws Exception {
|
|
|
MessageBufferPacker packer = MessagePack.newDefaultBufferPacker();
|
|
|
|
|
|
// 序列化成一个 Map,包含 "cmd" 和 "data"
|
|
@@ -183,7 +184,7 @@ public abstract class MsgBase {
|
|
|
}
|
|
|
|
|
|
packer.close();
|
|
|
- return packer.toByteArray();
|
|
|
+ return packer.toMessageBuffer();
|
|
|
}
|
|
|
|
|
|
/**
|