add other messaging types for finer control
This commit is contained in:
parent
e7a64d07f4
commit
728bf33856
1 changed files with 33 additions and 0 deletions
|
@ -3,9 +3,42 @@ export enum MessageType {
|
|||
SYSTEM,
|
||||
HELLO,
|
||||
DATA,
|
||||
}
|
||||
export enum SystemMessageCode {
|
||||
REQ,
|
||||
RES,
|
||||
ERR,
|
||||
}
|
||||
export type HistoryFetchResult = {
|
||||
count: number,
|
||||
items: Array<ChatMessage>,
|
||||
}
|
||||
export type ErrorResult = {
|
||||
text: string,
|
||||
}
|
||||
export type TimestampSendRequest = {
|
||||
ts: number,
|
||||
}
|
||||
export type SystemMessage = {
|
||||
code: SystemMessageCode
|
||||
data: HistoryFetchResult | ErrorResult | TimestampSendRequest
|
||||
}
|
||||
export type ChatMessage = {
|
||||
fromUserId: string,
|
||||
toUserId: string,
|
||||
content: string,
|
||||
timeMillis: number
|
||||
}
|
||||
export type HelloMessage = {
|
||||
fromUserId: string,
|
||||
timeMillis: number,
|
||||
}
|
||||
export type DataMessage = {
|
||||
|
||||
}
|
||||
export type Message = {
|
||||
type: MessageType,
|
||||
// data: SystemMessage | ChatMessage | HelloMessage
|
||||
fromUserId: string,
|
||||
toUserId: string,
|
||||
content: string,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue