web addon: change message version

addon-dailer
lqqyt2423 3 years ago
parent 239fda6dea
commit 8f7929ad46

@ -33,7 +33,7 @@ export const parseMessage = (data: ArrayBuffer): IMessage | null => {
if (data.byteLength < 39) return null
const meta = new Int8Array(data.slice(0, 39))
const version = meta[0]
if (version !== 1) return null
if (version !== 2) return null
const type = meta[1] as MessageType
if (!allMessageBytes.includes(type)) return null
const id = new TextDecoder().decode(data.slice(2, 38))

@ -13,7 +13,7 @@ import (
// message:
// type: 0/1/2/3/4
// type: 0/1/2/3/4/5
// messageFlow
// version 1 byte + type 1 byte + id 36 byte + waitIntercept 1 byte + content left bytes
@ -25,7 +25,7 @@ import (
// messageMeta
// version 1 byte + type 1 byte + content left bytes
const messageVersion = 1
const messageVersion = 2
type messageType byte

Loading…
Cancel
Save