Skip to content
v1
文档/Browser JS SDK/消息

@beeworks/imsdk


@beeworks/imsdk / message / AbstractMessage

Abstract Class: AbstractMessage

抽象消息基类

所有消息类型(文本、图片、语音等)的基类。 包含消息的基本属性和通用方法。

Properties

Message_Type_HandshakeMessage

static Message_Type_HandshakeMessage: number = 0b00001101

握手消息


Message_Type_PingMessage

static Message_Type_PingMessage: number = 0b00100101

Ping消息


Message_Type_PongMessage

static Message_Type_PongMessage: number = 0b00101001

Pong消息


Message_Type_HelloMessage

static Message_Type_HelloMessage: number = 0b00010001

Hello消息


Message_Type_PushMessage

static Message_Type_PushMessage: number = 0b00110001

Push消息


Message_Type_UndoMessage

static Message_Type_UndoMessage: number = 0b01001001

UnDo消息


Message_Type_RemoveMessage

static Message_Type_RemoveMessage: number = 0b01000101

Remove消息


Message_Type_RejectMessage

static Message_Type_RejectMessage: number = 0b00000101

Reject 消息


Message_Type_READ

static Message_Type_READ: number = 0b01000001

已读消息


Message_Type_Confirm

static Message_Type_Confirm: number = 0b00001001

消息


Message_Type_GoodBy

static Message_Type_GoodBy: number = 0b00000001

Goodbye 连接关闭(服务端到客户端)


Message_Type_Hello

static Message_Type_Hello: number = 0b00011001

Hello 设备握手响应


Message_Type_Up

static Message_Type_Up: number = 0b00011101

Up 设备上线


Message_Type_Down

static Message_Type_Down: number = 0b00100001

Down 设备下线


Message_Type_Write

static Message_Type_Write: number = 0b00110101

Write 消息输入中


Message_Type_Check

static Message_Type_Check: number = 0b00111001

Check


deliveryId

deliveryId: string = ''

消息ID


deliveryTime

deliveryTime: number

消息时间


deliverySeq

deliverySeq: number | Long = -1

消息逻辑排序号


fromId?

optional fromId: string

消息发送者ID


fromDomain?

optional fromDomain: string

消息发送者domainId


fromType?

optional fromType: ParticipantTypeFormat | CONV_C2C | CONV_C2G

消息发送者类型


toId?

optional toId: string

消息接收者ID


toDomain?

optional toDomain: string

消息接收者domain


bodyType?

optional bodyType: MessageType

消息类型


atAll

atAll: boolean = false

是否@所有人


at

at: IContactFormat[] = []

联系人列表


toType?

optional toType: ParticipantTypeFormat | ConversationType

消息接收者类型


status

status: SenderStatus = SenderStatus.Sended

消息发送状态


undoType

undoType: MessageUndoType = MessageUndoType.NONE

消息撤销类型


metadata

metadata: MessageMetadata

消息元数据


rawMetadata

rawMetadata: Record<string, string> = {}

服务端消息中的原始 metadata,用于保留 SDK 未建模的协议字段。


readStatus?

optional readStatus: string

已读状态


retries?

optional retries: number | null = 0

重发次数


conversationId?

optional conversationId: string

消息会话ID


conversationType?

optional conversationType: string

消息会话类型


actionId?

optional actionId: string

响应的消息ID


actionTime?

optional actionTime: number

消息时间


refreshTime?

optional refreshTime: number

消息更新时间


quote?

optional quote: any

引用消息(回复消息)


read?

optional read: number

已读人数


readTime?

optional readTime: number

已读时间


platforms?

optional platforms: any = null

支持平台


MY_NAME

static MY_NAME: string = 'my_name'

消息体中包含的元数据的key

Methods

updateBaseFromIMessage()

updateBaseFromIMessage(imessage): void

从IMessage中构建出一个消息

Parameters

imessage

IMessage

Returns

void


setMetadata()

setMetadata(context, content): void

设置消息体中包含的元数据

Parameters

context

any

content

any

Returns

void


updateBaseFromIMessageFormat()

updateBaseFromIMessageFormat(message): void

从IMessageFormat中构建出一个消息

Parameters

message

MessageFormat

Returns

void


updateBaseInfo()

updateBaseInfo(pushFormat): void

解析消息的最基本的值

Parameters

pushFormat

PushFormat

Returns

void


getConversationIdentifier()

getConversationIdentifier(): string

获取当前会话的identifier

Returns

string


isUserMessage()

isUserMessage(): boolean

是否是单聊消息

Returns

boolean


isDiscussionMessage()

isDiscussionMessage(): boolean

是否是讨论组消息

Returns

boolean


isSenderMessage()

isSenderMessage(): boolean

是否是我发送的消息

Returns

boolean


isUndo()

isUndo(): boolean

消息是否已被撤回

Returns

boolean