mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 14:20:01 -04:00
monorepo part 1
This commit is contained in:
parent
aa838cbff6
commit
2138e02613
26 changed files with 681 additions and 14437 deletions
32
protocol/src/index.ts
Normal file
32
protocol/src/index.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
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>;
|
||||
|
||||
export type ProtoBareHeaders = Record<string, string | string[]>;
|
||||
|
||||
export type HTTPRequestPayload = {
|
||||
method: string;
|
||||
requestHeaders: ProtoBareHeaders;
|
||||
body: string | null;
|
||||
remote: URL;
|
||||
};
|
||||
|
||||
export type HTTPResponsePayload = {
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: ProtoBareHeaders;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue