Fix get history

This commit is contained in:
Jack Hadrill 2024-11-19 23:46:23 +00:00
parent 386e8c3ed1
commit 26af3b8b69
2 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
export const MAX_DATA_LENGTH = 1000 export const MAX_DATA_LENGTH = 1000;
export const DEFAULT_KEY = new Uint8Array(16) export const DEFAULT_KEY = new Uint8Array(16);
export enum MessageTypes { export enum MessageTypes {
Subscribe = 0x0000, Subscribe = 0x0000,
@ -9,4 +9,5 @@ export enum MessageTypes {
UserDataResponse = 0x0003, UserDataResponse = 0x0003,
Keepalive = 0x0005, Keepalive = 0x0005,
GetHistory = 0xfffe, GetHistory = 0xfffe,
Unsubscribe = 0xffff,
} }

View File

@ -1,3 +1,15 @@
import { packSubscribeMessage } from "./messages/subscribe";
import { packBasicMessage, unpackBasicMessage } from "./messages/basic";
import {
packUserDataRequestMessage,
unpackUserDataRequestMessage,
} from "./messages/userDataRequest";
import {
packUserDataResponseMessage,
unpackUserDataResponseMessage,
} from "./messages/userDataResponse";
import { packKeepaliveMessage } from "./messages/keepalive";
import { packUnsubscribeMessage } from "./messages/unsubscribe";
import { packGetHistoryMessage } from "./messages/history"; import { packGetHistoryMessage } from "./messages/history";
export const packers = { export const packers = {
@ -8,9 +20,10 @@ export const packers = {
0x0005: packKeepaliveMessage, 0x0005: packKeepaliveMessage,
0xfffe: packGetHistoryMessage, 0xfffe: packGetHistoryMessage,
0xffff: packUnsubscribeMessage, 0xffff: packUnsubscribeMessage,
};
export const unpackers = { export const unpackers = {
0x0001: unpackBasicMessage, 0x0001: unpackBasicMessage,
0x0002: unpackUserDataRequestMessage, 0x0002: unpackUserDataRequestMessage,
0x0003: unpackUserDataResponseMessage 0x0003: unpackUserDataResponseMessage,
} };