Documentation
¶
Index ¶
- Constants
- func BoolToInt(b bool) int
- func IntToBool(i int) bool
- func Ptr[T cmp.Ordered | bool](v T) *T
- type AddOrRemoveSystemUsersRequest
- type BatchGetMessageRequest
- type BatchSendMessageRequst
- type BatchSendMessageResponse
- type BatchUserIMAddr
- type Bool
- type Channel
- type ChannelBlackOrWhiteList
- type ChannelSubscriber
- type ChannelType
- type ClearConversationUnreadRequest
- type Config
- type ConnInfo
- type ConnzConnection
- type Conversation
- type ConversationInfo
- type DeviceFlag
- type DeviceLevel
- type Event
- type GetChannelWhiteListRequest
- type GetConnzResponse
- type GetMaxMessageSeqResponse
- type GetMessageRequest
- type GetMessageResponse
- type GoWk
- func (g *GoWk) AddChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) AddChannelSubscriber(ctx context.Context, req ChannelSubscriber) (*StatusResponse, error)
- func (g *GoWk) AddChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) AddSystemUser(ctx context.Context, req AddOrRemoveSystemUsersRequest) (*StatusResponse, error)
- func (g *GoWk) BatchGetMessage(ctx context.Context, req BatchGetMessageRequest) ([]GetMessageResponse, error)
- func (g *GoWk) BatchGetUserIMAddr(ctx context.Context, intranet int, userId ...string) ([]BatchUserIMAddr, error)
- func (g *GoWk) BatchSendMessage(ctx context.Context, req BatchSendMessageRequst) (*BatchSendMessageResponse, error)
- func (g *GoWk) ClearConversationUnread(ctx context.Context, req ClearConversationUnreadRequest) (*StatusResponse, error)
- func (g *GoWk) CreateChannel(ctx context.Context, req Channel) (*StatusResponse, error)
- func (g *GoWk) DeleteChannel(ctx context.Context, req Channel) (*StatusResponse, error)
- func (g *GoWk) DeleteConversation(ctx context.Context, req ConversationInfo) (*StatusResponse, error)
- func (g *GoWk) GetChannelWhiteList(ctx context.Context, req GetChannelWhiteListRequest) ([]string, error)
- func (g *GoWk) GetConnz(ctx context.Context, offset, limit, subs *int) (*GetConnzResponse, error)
- func (g *GoWk) GetMaxMessageSeq(ctx context.Context, channelId string, channelType ChannelType) (*GetMaxMessageSeqResponse, error)
- func (g *GoWk) GetMessageByID(ctx context.Context, req GetMessageRequest) (*GetMessageResponse, error)
- func (g *GoWk) GetMigrateReult(ctx context.Context) (*MigrationStatusResponse, error)
- func (g *GoWk) GetOnlineStatus(ctx context.Context, uid ...string) ([]OnlineStatus, error)
- func (g *GoWk) GetSystemUserID(ctx context.Context) ([]string, error)
- func (g *GoWk) GetUserIMAddr(ctx context.Context, intranet int) (*UserIMAddr, error)
- func (g *GoWk) GetVarz(ctx context.Context, sort *string, connLimit *int, nodeId *int) (*ServerStatusResponse, error)
- func (g *GoWk) HealthCheck(ctx context.Context) (*StatusResponse, error)
- func (g *GoWk) KickConn(ctx context.Context, req ConnInfo) (*StatusResponse, error)
- func (g *GoWk) MessageSync(ctx context.Context, req MessageSyncRequest) (*MessageSyncResponse, error)
- func (g *GoWk) QuitUserDevice(ctx context.Context, req QuitUserDeviceRequest) (*StatusResponse, error)
- func (g *GoWk) RemoveChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) RemoveChannelSubscriber(ctx context.Context, req ChannelSubscriber) (*StatusResponse, error)
- func (g *GoWk) RemoveChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) RemoveConn(ctx context.Context, req ConnInfo) (*StatusResponse, error)
- func (g *GoWk) RemoveSystemUser(ctx context.Context, req AddOrRemoveSystemUsersRequest) (*StatusResponse, error)
- func (g *GoWk) RestyClient() *resty.Client
- func (g *GoWk) SearchUserMessage(ctx context.Context, req SearchUserMessagesRequest) (*SearchUserMessagesResponse, error)
- func (g *GoWk) SendEvent(ctx context.Context, force *string, req ConnInfo) (*StatusResponse, error)
- func (g *GoWk) SendMessage(ctx context.Context, req Message) (*SendMessageResponse, error)
- func (g *GoWk) SetChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) SetChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
- func (g *GoWk) SetConversationUnread(ctx context.Context, req SetConversationUnreadRequest) (*StatusResponse, error)
- func (g *GoWk) SetUserToken(ctx context.Context, req SetUserTokenRequest) (*StatusResponse, error)
- func (g *GoWk) SyncConversation(ctx context.Context, req SyncConversationRequest) ([]Conversation, error)
- func (g *GoWk) UpdateChannelInfo(ctx context.Context, req Channel) (*StatusResponse, error)
- func (g *GoWk) UpdateUserToken(ctx context.Context, req UpdateUserTokenRequest) (*StatusResponse, error)
- type HTTPReqStats
- type Header
- type Message
- type MessageSyncRequest
- type MessageSyncResponse
- type MigrationStatusResponse
- type OnlineStatus
- type Option
- type PullMode
- type QuitUserDeviceRequest
- type RecentItem
- type SearchUserMessagesRequest
- type SearchUserMessagesResponse
- type SearchedMessage
- type SendEventRequest
- type SendMessageResponse
- type ServerStatusResponse
- type SetConversationUnreadRequest
- type SetUserTokenRequest
- type StatusResponse
- type SyncConversationRequest
- type URIStat
- type UpdateUserTokenRequest
- type UserIMAddr
Constants ¶
View Source
const ( Intranet_External = 0 // 外网地址 Intranet_Intent = 1 // 内网地址 )
View Source
const ( NoPersist_Y = 0 // 持久化 NoPersist_N = 1 // 不持久化 RedHot_Hide = 0 // 不显示红点 RedHot_Show = 1 // 显示红点 SyncOnce_Read = 0 // 读扩散 SyncOnce_Write = 1 // 写扩散(cmd消息) )
View Source
const ( Ban_N = 0 // 允许发言 Ban_Y = 1 // 全员禁言 Disband_N = 0 // 不解散频道 Disband_Y = 1 // 解散频道 SendBan_N = 0 // 不禁止发消息 SendBan_Y = 1 // 禁止发消息 AllowStranger_N = 0 // 不允许陌生人发消息 AllowStranger_Y = 1 // 允许陌生人发消息 )
View Source
const ( Reset_N = 0 // 不重置 Reset_Y = 1 // 重置 TempSubscriber_N = 0 // 永久订阅者 TempSubscriber_Y = 1 // 临时订阅者 )
View Source
const ( OnlyUnread_N = 0 // 所有 OnlyUnread_Y = 1 // 只有未读 )
View Source
const ( Force_N = 0 // 不强制 Force_Y = 1 // 强制 )
View Source
const ( IncludeSubs_N = 0 // 不包含订阅者信息 IncludeSubs_Y = 1 // 包含订阅者信息 )
View Source
const ( DeviceFlag_APP DeviceFlag = iota // APP DeviceFlag_WEB = 1 // WEB DeviceFlag_PC = 2 // PC DeviceFlag_SYSTEM = 99 // SYSTEM 系统 )
View Source
const ( OnlineStatus_Offline = 0 // 离线 OnlineStatus_Online = 1 // 在线 )
View Source
const ( VarzSort_InMsgs = "in_msgs" // 按接收消息数排序 VarzSort_OutMsgs = "out_msgs" // 按发送消息数排序 VarzSort_InBytes = "in_bytes" // 按接收字节数排序 VarzSort_OutBytes = "out_bytes" // 按发送字节数排序 )
View Source
const ( MigrateStatus_Running = "running" // 迁移正在进行中 MigrateStatus_Completed = "completed" // 迁移已完成 MigrateStatus_Migrated = "migrated" // 迁移已完成(历史状态) )
View Source
const ( WebHookEvent_UserOnlineStatus = "user.onlinestatus" // 用户在线状态通知 MigrateStatus_MsgOffline = "msg.offline" // 离线消息通知 MigrateStatus_MsgNotify = "msg.notify" // 所有消息通知 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddOrRemoveSystemUsersRequest ¶
type AddOrRemoveSystemUsersRequest struct {
UIDs []string `json:"uids"` // 用户 ID 数组
}
type BatchGetMessageRequest ¶
type BatchGetMessageRequest struct {
MessageIDs []int64 `json:"message_ids"` // 必传,消息 ID 列表
}
type BatchSendMessageRequst ¶ added in v0.0.2
type BatchSendMessageResponse ¶ added in v0.0.2
type BatchUserIMAddr ¶
type BatchUserIMAddr struct {
Uids []string `json:"uids"`
UserIMAddr
}
type Channel ¶
type Channel struct {
ChannelID string `json:"channel_id"` // 必传,频道 ID,必须唯一
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人频道, 2=群组频道)
Ban *int `json:"ban,omitempty"` // 可选,是否禁言 (0=允许发言,1=全员禁言)
Disband *int `json:"disband,omitempty"` // 可选,是否解散频道 (1=解散)
SendBan *int `json:"send_ban,omitempty"` // 可选,是否禁止发送消息 (0=不禁止,1=禁止)
AllowStranger *int `json:"allow_stranger,omitempty"` // 可选,是否允许陌生人发送消息 (仅个人频道支持)
Subscribers *[]string `json:"subscribers,omitempty"` // 可选,订阅者用户 ID 列表
}
type ChannelBlackOrWhiteList ¶
type ChannelBlackOrWhiteList struct {
ChannelID string `json:"channel_id"` // 必传,频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人频道, 2=群组频道)
UIDs []string `json:"uids"` // 要加入黑名单的用户 ID 列表
}
type ChannelSubscriber ¶
type ChannelSubscriber struct {
ChannelID string `json:"channel_id"` // 必传,频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人频道, 2=群组频道)
Subscribers []string `json:"subscribers"` // 必传,要添加的订阅者用户 ID 列表
Reset *int `json:"reset,omitempty"` // 可选,是否重置现有订阅者 (0=不重置,1=重置)
TempSubscriber *int `json:"temp_subscriber,omitempty"` // 可选,是否为临时订阅者 (0=永久,1=临时)
}
type ChannelType ¶
type ChannelType uint8 // 频道类型
const ( ChannelType_Person ChannelType = 1 // 个人频道 ChannelType_Group ChannelType = 2 // 群组频道 ChannelType_CustomerService ChannelType = 3 // 客服频道 ChannelType_Community ChannelType = 4 // 社区频道 ChannelType_CommunityTopic ChannelType = 5 // 社区话题频道 ChannelType_Info ChannelType = 6 // 资讯频道(有临时订阅者的概念,查看资讯的时候加入临时订阅,退出资讯的时候退出临时订阅) ChannelType_Data ChannelType = 7 // 数据频道 ChannelType_Temp ChannelType = 8 // 临时频道 ChannelType_Live ChannelType = 9 // 直播频道(直播频道不会保存最近会话数据) ChannelType_Visitors ChannelType = 10 // 访客频道 (频道id即为访客id,此频道只支持一个访客订阅者,多个客服订阅者,ChannelTypeCustomerService频道已过时,使用ChannelTypeVisitors代替) ChannelType_Agent ChannelType = 11 // 单聊Agent频道(AI Agent频道,频道ID内部结构为UID@AgentID的结构,类似单聊频道,此频道会针对于AI Agent场景做优化) ChannelType_AgentGroup ChannelType = 12 // 群聊Agent频道(AI Agent群聊频道,类似群聊频道,此频道会针对于多Agent协同场景做优化) )
type ClearConversationUnreadRequest ¶
type ClearConversationUnreadRequest struct {
ConversationInfo
MessageSeq *int64 `json:"message_seq,omitempty"` // 可选,清除到哪条消息
}
type Config ¶
type Config struct {
MaxConnections int `json:"max_connections"` // 最大连接数限制
MaxSubscriptionsPerConn int `json:"max_subscriptions_per_conn"` // 每连接最大订阅数
MaxPayload int `json:"max_payload"` // 最大消息载荷大小 (字节)
}
Config 系统配置信息
type ConnzConnection ¶
type ConnzConnection struct {
CID int64 `json:"cid"` // 连接 ID
UID string `json:"uid"` // 用户 ID
IP string `json:"ip"` // 客户端 IP 地址
Port int `json:"port"` // 客户端端口
Start string `json:"start"` // 连接开始时间
LastActivity string `json:"last_activity"` // 最后活动时间
Uptime string `json:"uptime"` // 连接持续时间
Idle string `json:"idle"` // 空闲时间
PendingBytes int64 `json:"pending_bytes"` // 待发送字节数
InMsgs int64 `json:"in_msgs"` // 接收消息数
OutMsgs int64 `json:"out_msgs"` // 发送消息数
InBytes int64 `json:"in_bytes"` // 接收字节数
OutBytes int64 `json:"out_bytes"` // 发送字节数
Subscriptions int `json:"subscriptions"` // 订阅数量
DeviceFlag DeviceFlag `json:"device_flag"` // 设备标识
DeviceLevel DeviceLevel `json:"device_level"` // 设备级别
Version string `json:"version"` // 客户端版本
}
Connection 连接详情
type Conversation ¶
type Conversation struct {
ChannelID string `json:"channel_id"` // 频道 ID
ChannelType ChannelType `json:"channel_type"` // 频道类型 (1=个人,2=群组)
Unread int `json:"unread"` // 未读消息数量
Timestamp int64 `json:"timestamp"` // 最后消息时间戳
LastMsgSeq int64 `json:"last_msg_seq"` // 最后消息序列号
LastClientMsgNo string `json:"last_client_msg_no"` // 最后一条消息的客户端消息编号
Version int64 `json:"version"` // 会话版本号(纳秒级时间戳)
Recents []RecentItem `json:"recents"` // 最新消息列表
}
Conversation 会话信息
type ConversationInfo ¶
type ConversationInfo struct {
UID string `json:"uid"` // 必传,用户 ID
ChannelID string `json:"channel_id"` // 必传,频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人,2=群组)
}
type DeviceFlag ¶
type DeviceFlag uint8 // DeviceFlag 设备类型
type DeviceLevel ¶
type DeviceLevel uint8 // 设备等级
const ( DeviceLevel_Slave DeviceLevel = 0 // 从设备 DeviceLevel_Master DeviceLevel = 1 // 主设备 )
type Event ¶
type Event struct {
Type string `json:"type"` // 必传,事件类型
ID *string `json:"id,omitempty"` // 可选,事件 ID
Timestamp *int64 `json:"timestamp,omitempty"` // 可选,事件时间戳(毫秒)
Data string `json:"data"` // 必传,事件数据内容
}
EventData 事件对象
type GetChannelWhiteListRequest ¶
type GetChannelWhiteListRequest struct {
ChannelID string `json:"channel_id"` // 必传,频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人频道, 2=群组频道)
}
type GetConnzResponse ¶
type GetConnzResponse struct {
Now string `json:"now"` // 当前服务器时间(ISO 8601)
NumConnections int `json:"num_connections"` // 当前连接数量
Total int `json:"total"` // 总连接数量
Offset int `json:"offset"` // 当前偏移量
Limit int `json:"limit"` // 当前限制数量
Connections []ConnzConnection `json:"connections"` // 连接详情列表
}
ListConnectionsResponse 查询连接列表响应
type GetMaxMessageSeqResponse ¶
type GetMaxMessageSeqResponse struct {
MessageID int64 `json:"message_id"` // 消息 ID
MessageSeq int64 `json:"message_seq"` // 消息序列号
ClientMsgNo string `json:"client_msg_no"` // 客户端消息编号(回显)
FromUID string `json:"from_uid"` // 发送者用户 ID
ChannelID string `json:"channel_id"` // 频道 ID
ChannelType ChannelType `json:"channel_type"` // 频道类型 (1=个人,2=群组)
Timestamp int64 `json:"timestamp"` // 消息时间戳
Payload string `json:"payload"` // Base64 编码的消息内容
}
type GetMessageRequest ¶
type GetMessageRequest struct {
MessageId int64 `json:"message_id"` // 必传,消息 ID 列表
}
type GetMessageResponse ¶
type GetMessageResponse struct {
MessageID int64 `json:"message_id"` // 服务器生成的消息 ID
MessageSeq int64 `json:"message_seq"` // 消息序列号
ClientMsgNo string `json:"client_msg_no"` // 客户端消息编号(回显)
FromUID string `json:"from_uid"` // 发送者用户 ID
ChannelID string `json:"channel_id"` // 频道 ID
ChannelType ChannelType `json:"channel_type"` // 频道类型 (1=个人,2=群组)
Timestamp int64 `json:"timestamp"` // 消息时间戳(Unix 时间戳)
Payload string `json:"payload"` // Base64 编码的消息内容
}
type GoWk ¶
type GoWk struct {
// contains filtered or unexported fields
}
func (*GoWk) AddChannelBlackList ¶
func (g *GoWk) AddChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
添加频道黑名单
func (*GoWk) AddChannelSubscriber ¶
func (g *GoWk) AddChannelSubscriber(ctx context.Context, req ChannelSubscriber) (*StatusResponse, error)
添加频道订阅者
func (*GoWk) AddChannelWhiteList ¶
func (g *GoWk) AddChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
添加频道白名单
func (*GoWk) AddSystemUser ¶
func (g *GoWk) AddSystemUser(ctx context.Context, req AddOrRemoveSystemUsersRequest) (*StatusResponse, error)
添加系统用户ID
func (*GoWk) BatchGetMessage ¶
func (g *GoWk) BatchGetMessage(ctx context.Context, req BatchGetMessageRequest) ([]GetMessageResponse, error)
批量消息搜索
func (*GoWk) BatchGetUserIMAddr ¶
func (g *GoWk) BatchGetUserIMAddr(ctx context.Context, intranet int, userId ...string) ([]BatchUserIMAddr, error)
批量获取用户IM地址
func (*GoWk) BatchSendMessage ¶
func (g *GoWk) BatchSendMessage(ctx context.Context, req BatchSendMessageRequst) (*BatchSendMessageResponse, error)
批量发送消息
func (*GoWk) ClearConversationUnread ¶
func (g *GoWk) ClearConversationUnread(ctx context.Context, req ClearConversationUnreadRequest) (*StatusResponse, error)
清除未读消息
func (*GoWk) CreateChannel ¶
创建频道
func (*GoWk) DeleteChannel ¶
删除频道
func (*GoWk) DeleteConversation ¶
func (g *GoWk) DeleteConversation(ctx context.Context, req ConversationInfo) (*StatusResponse, error)
删除会话
func (*GoWk) GetChannelWhiteList ¶
func (g *GoWk) GetChannelWhiteList(ctx context.Context, req GetChannelWhiteListRequest) ([]string, error)
获取频道白名单
func (*GoWk) GetMaxMessageSeq ¶
func (g *GoWk) GetMaxMessageSeq(ctx context.Context, channelId string, channelType ChannelType) (*GetMaxMessageSeqResponse, error)
获取频道最大消息序号
func (*GoWk) GetMessageByID ¶
func (g *GoWk) GetMessageByID(ctx context.Context, req GetMessageRequest) (*GetMessageResponse, error)
单条消息搜索
func (*GoWk) GetMigrateReult ¶
func (g *GoWk) GetMigrateReult(ctx context.Context) (*MigrationStatusResponse, error)
获取迁移结果
func (*GoWk) GetOnlineStatus ¶
获取设备在线状态
func (*GoWk) GetSystemUserID ¶
获取系统用户ID
func (*GoWk) GetUserIMAddr ¶
获取用户IM地址
func (*GoWk) GetVarz ¶
func (g *GoWk) GetVarz(ctx context.Context, sort *string, connLimit *int, nodeId *int) (*ServerStatusResponse, error)
获取系统变量
func (*GoWk) HealthCheck ¶
func (g *GoWk) HealthCheck(ctx context.Context) (*StatusResponse, error)
健康检查
func (*GoWk) MessageSync ¶
func (g *GoWk) MessageSync(ctx context.Context, req MessageSyncRequest) (*MessageSyncResponse, error)
同步频道历史消息
func (*GoWk) QuitUserDevice ¶
func (g *GoWk) QuitUserDevice(ctx context.Context, req QuitUserDeviceRequest) (*StatusResponse, error)
强制设备退出
func (*GoWk) RemoveChannelBlackList ¶
func (g *GoWk) RemoveChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
移除频道黑名单
func (*GoWk) RemoveChannelSubscriber ¶
func (g *GoWk) RemoveChannelSubscriber(ctx context.Context, req ChannelSubscriber) (*StatusResponse, error)
移除频道订阅者
func (*GoWk) RemoveChannelWhiteList ¶
func (g *GoWk) RemoveChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
移除频道白名单
func (*GoWk) RemoveConn ¶
移除连接
func (*GoWk) RemoveSystemUser ¶
func (g *GoWk) RemoveSystemUser(ctx context.Context, req AddOrRemoveSystemUsersRequest) (*StatusResponse, error)
移除系统用户ID
func (*GoWk) RestyClient ¶
func (*GoWk) SearchUserMessage ¶
func (g *GoWk) SearchUserMessage(ctx context.Context, req SearchUserMessagesRequest) (*SearchUserMessagesResponse, error)
用户消息搜索
func (*GoWk) SendMessage ¶
发送消息
func (*GoWk) SetChannelBlackList ¶
func (g *GoWk) SetChannelBlackList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
设置频道黑名单
func (*GoWk) SetChannelWhiteList ¶
func (g *GoWk) SetChannelWhiteList(ctx context.Context, req ChannelBlackOrWhiteList) (*StatusResponse, error)
设置频道白名单
func (*GoWk) SetConversationUnread ¶
func (g *GoWk) SetConversationUnread(ctx context.Context, req SetConversationUnreadRequest) (*StatusResponse, error)
设置会话未读数
func (*GoWk) SetUserToken ¶ added in v0.0.3
func (g *GoWk) SetUserToken(ctx context.Context, req SetUserTokenRequest) (*StatusResponse, error)
设置用户Token
func (*GoWk) SyncConversation ¶
func (g *GoWk) SyncConversation(ctx context.Context, req SyncConversationRequest) ([]Conversation, error)
同步用户会话
func (*GoWk) UpdateChannelInfo ¶
更新频道信息
func (*GoWk) UpdateUserToken ¶
func (g *GoWk) UpdateUserToken(ctx context.Context, req UpdateUserTokenRequest) (*StatusResponse, error)
更新用户Token
type HTTPReqStats ¶
type HTTPReqStats struct {
URIStats []URIStat `json:"uri_stats"` // URI 统计列表
}
HTTPReqStats HTTP 请求统计信息
type Message ¶
type Message struct {
Payload string `json:"payload"` // 必传,Base64 编码的消息内容
FromUID string `json:"from_uid"` // 必传,发送者用户 ID
ChannelID string `json:"channel_id"` // 必传,目标频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人, 2=群组)
Header *Header `json:"header,omitempty"` // 可选,消息头部信息
ClientMsgNo *string `json:"client_msg_no,omitempty"` // 可选,客户端消息编号
StreamNo *string `json:"stream_no,omitempty"` // 可选,流消息编号
Expire *int64 `json:"expire,omitempty"` // 可选,消息过期时间(秒),0 表示不过期
Subscribers []string `json:"subscribers,omitempty"` // 可选,指定订阅者(CMD消息有效)
}
type MessageSyncRequest ¶
type MessageSyncRequest struct {
LoginUID string `json:"login_uid"` // 必传,当前登录用户 ID
ChannelID string `json:"channel_id"` // 必传,频道 ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人, 2=群组)
StartMessageSeq *int64 `json:"start_message_seq,omitempty"` // 可选,起始消息序号(包含)
EndMessageSeq *int64 `json:"end_message_seq,omitempty"` // 可选,结束消息序号(不包含)
Limit *int `json:"limit,omitempty"` // 可选,返回消息数量限制,最大 10000
PullMode *PullMode `json:"pull_mode,omitempty"` // 可选,拉取模式 (0=向下拉取, 1=向上拉取)
}
type MessageSyncResponse ¶ added in v0.0.2
type MessageSyncResponse struct {
StartMessageSeq uint32 `json:"start_message_seq"` // 查询的start_message_seq
EndMessageSeq uint32 `json:"end_message_seq"` // 查询的end_message_seq
More int `json:"more"` // 是否有更多 0.无 1.有
Messages []RecentItem `json:"messages"` // 最近N条消息
}
type MigrationStatusResponse ¶
type OnlineStatus ¶
type OnlineStatus struct {
UID string `json:"uid"` // 用户 ID
Online int `json:"online"` // 在线状态 (0=离线, 1=在线)
DeviceFlag DeviceFlag `json:"device_flag"` // 设备标识 (0=app, 1=web, 2=desktop)
}
type QuitUserDeviceRequest ¶
type QuitUserDeviceRequest struct {
UID string `json:"uid"` // 必传,用户唯一 ID
DeviceFlag DeviceFlag `json:"device_flag"` // 必传,设备标识 (0=app,1=web,2=desktop)
}
type RecentItem ¶ added in v0.0.2
type RecentItem struct {
Header Header `json:"header"` // 消息头
Setting uint8 `json:"setting"` // // 消息设置 消息设置是一个 uint8的数字类型 为1个字节,完全由第三方自定义 比如定义第8位为已读未读回执标记,开启则为0000 0001 = 1
MessageID int64 `json:"message_id"` // 消息 ID
MessageSeq int64 `json:"message_seq"` // 消息序列号
ClientMsgNo string `json:"client_msg_no"` // 客户端消息编号(回显)
FromUID string `json:"from_uid"` // 发送者用户 ID
ChannelID string `json:"channel_id"` // 频道 ID
ChannelType ChannelType `json:"channel_type"` // 频道类型 (1=个人,2=群组)
Timestamp int64 `json:"timestamp"` // 消息时间戳
Payload string `json:"payload"` // Base64 编码的消息内容
}
type SearchUserMessagesRequest ¶
type SearchUserMessagesRequest struct {
UID string `json:"uid"` // 必传,当前用户 UID
Payload map[string]any `json:"payload,omitempty"` // 可选,消息 payload,自定义字段
PayloadTypes []int `json:"payload_types,omitempty"` // 可选,消息类型搜索
FromUID *string `json:"from_uid,omitempty"` // 可选,发送者 UID
ChannelID *string `json:"channel_id,omitempty"` // 可选,频道 ID
ChannelType *ChannelType `json:"channel_type,omitempty"` // 可选,频道类型 (1=个人,2=群组)
Topic *string `json:"topic,omitempty"` // 可选,topic 搜索
Limit *int `json:"limit,omitempty"` // 可选,限制数量(默认 10)
Page *int `json:"page,omitempty"` // 可选,页码(默认 1)
StartTime *int64 `json:"start_time,omitempty"` // 可选,消息时间(开始)
EndTime *int64 `json:"end_time,omitempty"` // 可选,消息时间(结束,包含 end_time)
Highlights []string `json:"highlights,omitempty"` // 可选,需要高亮的字段
}
type SearchUserMessagesResponse ¶
type SearchUserMessagesResponse struct {
Total int `json:"total"` // 消息总数量
Limit int `json:"limit"` // 查询数量限制
Page int `json:"page"` // 当前页码
Messages []SearchedMessage `json:"messages"` // 消息列表
}
type SearchedMessage ¶
type SearchedMessage struct {
MessageID int64 `json:"message_id"` // 消息唯一 ID
MessageIDStr string `json:"message_idstr"` // 消息唯一 ID(字符串形式)
MessageSeq int64 `json:"message_seq"` // 消息序号
ClientMsgNo string `json:"client_msg_no"` // 客户端消息唯一编号
FromUID string `json:"from_uid"` // 发送者 UID
ChannelID string `json:"channel_id"` // 频道 ID
ChannelType ChannelType `json:"channel_type"` // 频道类型 (1=个人频道, 2=群组频道)
Payload map[string]interface{} `json:"payload"` // 消息内容对象(通用 payload,用 map 接收)
Topic *string `json:"topic,omitempty"` // 可选,消息 topic
Timestamp int64 `json:"timestamp"` // 消息时间戳(10位到秒)
}
type SendEventRequest ¶
type SendEventRequest struct {
ClientMsgNo string `json:"client_msg_no"` // 必传,客户端消息编号,必须唯一
ChannelID string `json:"channel_id"` // 必传,目标频道ID
ChannelType ChannelType `json:"channel_type"` // 必传,频道类型 (1=个人, 2=群组)
FromUid string `json:"from_uid"` // 发送者UID
Event Event `json:"event"` // 必传,事件对象
}
SendEventRequest 发送事件请求
type SendMessageResponse ¶
type ServerStatusResponse ¶
type ServerStatusResponse struct {
// 服务器信息
ServerID string `json:"server_id"` // 服务器标识符
Version string `json:"version"` // WuKongIM 版本号
GitCommit string `json:"git_commit"` // Git 提交哈希
GoVersion string `json:"go_version"` // Go 语言版本
// 运行时信息
Start string `json:"start"` // 服务器启动时间 (ISO 8601)
Now string `json:"now"` // 当前时间 (ISO 8601)
Uptime string `json:"uptime"` // 运行时长
// 连接统计
Connections int `json:"connections"` // 当前连接数
TotalConnections int `json:"total_connections"` // 历史累计连接数
SlowConsumers int `json:"slow_consumers"` // 慢消费者数量
Subscriptions int `json:"subscriptions"` // 订阅总数
// 消息统计
InMsgs int64 `json:"in_msgs"` // 接收消息总数
OutMsgs int64 `json:"out_msgs"` // 发送消息总数
InBytes int64 `json:"in_bytes"` // 接收字节总数
OutBytes int64 `json:"out_bytes"` // 发送字节总数
// HTTP 请求统计
HTTPReqStats HTTPReqStats `json:"http_req_stats"`
// 系统资源
CPU float64 `json:"cpu"` // CPU 使用率 (%)
Mem int64 `json:"mem"` // 内存使用量 (字节)
// 配置信息
Config Config `json:"config"`
}
ServerStatusResponse 服务器状态响应
type SetConversationUnreadRequest ¶
type SetConversationUnreadRequest struct {
ConversationInfo
Unread int `json:"unread"` // 未读消息数量
}
type SetUserTokenRequest ¶ added in v0.0.3
type SetUserTokenRequest struct {
UID string `json:"uid"` // 必传,用户唯一 ID
Token string `json:"token"` // 必传,校验的 token
DeviceFlag DeviceFlag `json:"device_flag"` // 必传,设备标识 (0=app,1=web,2=desktop)
DeviceLevel *DeviceLevel `json:"device_level,omitempty"` // 可选,设备等级 (0=从设备,1=主设备)
}
type StatusResponse ¶
type StatusResponse struct {
StatusCode int `json:"-"`
Status int `json:"status"` // 操作状态,成功时返回 "ok"
Msg string `json:"msg"`
Data any `json:"data"`
}
func (*StatusResponse) Error ¶
func (r *StatusResponse) Error() string
func (*StatusResponse) IsOk ¶
func (r *StatusResponse) IsOk() bool
type SyncConversationRequest ¶
type SyncConversationRequest struct {
UID string `json:"uid"` // 必传:用户 ID
Version *int64 `json:"version,omitempty"` // 可选:版本时间戳(增量同步)
LastMsgSeqs *string `json:"last_msg_seqs,omitempty"` // 可选:最后消息序列号
MsgCount *int `json:"msg_count,omitempty"` // 可选:每个会话返回的最近消息数量
OnlyUnread *int `json:"only_unread,omitempty"` // 可选:是否只返回未读 (0=全部,1=未读)
ExcludeChannelTypes []ChannelType `json:"exclude_channel_types,omitempty"` // 可选:要排除的频道类型
}
type URIStat ¶
type URIStat struct {
URI string `json:"uri"` // 请求 URI
Count int `json:"count"` // 请求次数
AvgTime string `json:"avg_time"` // 平均响应时间
}
URIStat 单个 URI 统计
type UpdateUserTokenRequest ¶
type UpdateUserTokenRequest SetUserTokenRequest
type UserIMAddr ¶
Click to show internal directories.
Click to hide internal directories.