26 lines
524 B
JavaScript
26 lines
524 B
JavaScript
import msgpack from 'msgpack-lite';
|
|
|
|
import SynchronizedPacket from './synchronized.packet';
|
|
|
|
export default class SynchronizedCreatePacket extends SynchronizedPacket {
|
|
|
|
static pack(packet) {
|
|
const data = packet.data[1];
|
|
data.spec = msgpack.encode(data.spec);
|
|
return super.pack(packet);
|
|
}
|
|
|
|
static get synchronizationSchema() {
|
|
return {
|
|
spec: 'buffer',
|
|
};
|
|
}
|
|
|
|
static unpack(packet) {
|
|
const data = super.unpack(packet);
|
|
data.spec = msgpack.decode(data.spec);
|
|
return data;
|
|
}
|
|
|
|
}
|