refactor to share protocol

This commit is contained in:
Spencer Pogorzelski 2023-08-11 16:57:10 -07:00
parent 51ae252748
commit 2022a4cee8
2 changed files with 23 additions and 28 deletions

17
protocol/index.ts Normal file
View file

@ -0,0 +1,17 @@
export type ObjectValues<T> = T[keyof T];
export const C2SRequestTypes = {
HTTPRequest: 0,
WSOpen: 1,
WSClose: 2,
WSSendText: 3,
WSSendBinary: 4,
} as const;
export type C2SRequestType = ObjectValues<typeof C2SRequestTypes>;
export const S2CRequestTypes = {
HTTPResponse: 0,
WSOpen: 1,
WSDataText: 2,
WSDataBinary: 3,
} as const;
export type S2CRequestType = ObjectValues<typeof S2CRequestTypes>;