socketStore.d.ts
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
export enum SocketStoreEnum {
  CONNECTION_POOL = 'connectionPool',
  SUBSCRIBE_POOL = 'subscribePool',
  CACHE_MESSAGE = 'cacheMessage',
  CURRENT_SUBSCRIBE_ID = 'currentSubscribeId',
  UNSUBSCRIBE_POOL = 'unsubscribePool',
  COMPONENT_UPDATE_FN_POOL = 'componentUpdateFnPool'
}
export interface KeyBoundComponentList {
  componentId: string
}
export interface SocketSendMessageItemType {
  cmdId: number
  entityId: string
  entityType: string
  keys: string
  scope: string
  unsubscribe?: boolean
}
export interface SocketSendMessageType {
  tsSubCmds: SocketSendMessageItemType[]
}
export interface SocketReceiveMessageType {
  subscriptionId: number,
  errorCode: number,
  errorMsg: Nullable<string>,
  data: {
    [key: string]: [number, string]
  },
  latestValues: {
    [key: string]: number
  }
}
export interface SocketConnectionPoolType {
  [key: string]: {
    [key: string]: KeyBoundComponentList[]
  }
}
export interface CacheMessageType {
  [key: number]: SocketReceiveMessageType[]
}
export interface SubscribePoolType {
  subscribeId: number
  entityId: string
}
export interface SocketComponentRecord {
  componentId: string
  keys: string[]
}
export interface UnsubscribePoolType {
  subscribeId: number,
  message: SocketSendMessageType 
}
export interface ComponentUpdateFnPoolType {
  [key: string]: Fn
}
export interface SocketStoreType {
  [SocketStoreEnum.CONNECTION_POOL]: SocketConnectionPoolType,
  [SocketStoreEnum.SUBSCRIBE_POOL]: SubscribePoolType[],
  [SocketStoreEnum.CACHE_MESSAGE]: CacheMessageType,
  [SocketStoreEnum.CURRENT_SUBSCRIBE_ID]: number,
  [SocketStoreEnum.UNSUBSCRIBE_POOL]: UnsubscribePoolType[]
  [SocketStoreEnum.COMPONENT_UPDATE_FN_POOL]: ComponentUpdateFnPoolType
}