destroy销毁 Client 实例
destroy(): Promise‹void›
返回
join加入房间
join(roomId: string, userId: number, sig: string, joinConfig: JoinConfig): Promise‹any›
参数
leave退出房间
leave(): Promise‹any›
sendMessage发送消息(一对一消息)
sendMessage(userId: number, message_type: string, message: any): Promise‹void›
onMessage设置单播消息监听,支持链式调用,支持命名空间
onMessage(message_type: string, listener: Function): Client
offMessage取消单播消息监听,支持链式调用,支持命名空间
offMessage(message_type: string, listener?: Function): Client
sendBroadcastMessage发送广播消息(一对多消息)
sendBroadcastMessage(message_type: string, message: any, options?: BroadcastMessageOptions): Promise‹void›
onBroadcastMessage设置广播消息监听,支持链式调用,支持命名空间
onBroadcastMessage(message_type: string, listener: Function): Client
offBroadcastMessage取消广播消息监听,支持链式调用,支持命名空间
offBroadcastMessage(message_type: string, listener?: Function): Client
getCachedBroadcastMessage获取缓存的广播消息(只能用于设置缓存了的广播消息)
getCachedBroadcastMessage(message_type: string): Promise‹object›
fire触发一个事件
fire(type: string, data?: any): void
on设置事件监听,支持链式调用支持命名空间 type.namespace,使用 . 来分隔 type 和 namespace
on(type: "user-kicked", listener: typeof client_event_user_kicked, options?: EmitterOptions): this
one设置一次事件监听
one(type: string, listener: Function, options: EmitterOptions): this
off取消事件监听,支持链式调用
off(type: string, listener?: Function): this
用户被踢出房间通知,被管理员踢出
client.on('user-kicked', () => { console.log('你已被踢出!'); });
用户被踢出房间通知,其他端以相同的 user_id 进入了房间
client.on('client-banned', () => { console.log('你已被踢出!'); });
聊天通道已连接
client.on('message-channel-opened', (event) => { });
错误• ERROR = "error"
Web
Implements
Properties
Methods
Methods
destroy
销毁 Client 实例
返回
join
加入房间
参数
返回
leave
退出房间
返回
sendMessage
发送消息(一对一消息)
参数
返回
onMessage
设置单播消息监听,支持链式调用,支持命名空间
参数
返回
offMessage
取消单播消息监听,支持链式调用,支持命名空间
参数
返回
sendBroadcastMessage
发送广播消息(一对多消息)
参数
返回
onBroadcastMessage
设置广播消息监听,支持链式调用,支持命名空间
参数
返回
offBroadcastMessage
取消广播消息监听,支持链式调用,支持命名空间
参数
返回
getCachedBroadcastMessage
获取缓存的广播消息(只能用于设置缓存了的广播消息)
参数
返回
getCachedBroadcastMessage
获取缓存的广播消息(只能用于设置缓存了的广播消息)
参数
返回
fire
触发一个事件
参数
返回
on
设置事件监听,支持链式调用支持命名空间 type.namespace,使用 . 来分隔 type 和 namespace
参数
返回
one
设置一次事件监听
参数
返回
off
取消事件监听,支持链式调用
参数
返回
ClientEvents
Index
Variables
用户被踢出房间通知,被管理员踢出
用户被踢出房间通知,其他端以相同的 user_id 进入了房间
聊天通道已连接
错误
• ERROR = "error"