feat[protocol]: 提升协议的兼容性,协议向前兼容

This commit is contained in:
jaysunxiao
2022-05-22 22:26:42 +08:00
parent 389de2b6b3
commit 78cb8bd2fc
28 changed files with 1192 additions and 1315 deletions
@@ -82,6 +82,10 @@ const ByteBuffer = function() {
}
};
this.isReadable = function() {
return this.writeOffset > this.readOffset;
};
this.writeBoolean = function(value) {
if (!(value === true || value === false)) {
throw new Error('value must be true of false');
@@ -339,7 +343,7 @@ const ByteBuffer = function() {
};
this.writePacketFlag = function(value) {
const flag = value === null;
const flag = (value === null) || (value === undefined);
this.writeBoolean(!flag);
return flag;
};