接口列表

  • HMREventObserver

Public 回调函数函数名
voiddidHummerStateChanged:toState:withReason:
voiddidHummerKicked:withDescription:
voiddidHummerPreviousTokenExpired
  • HMRPeerServiceObserver

Public 回调函数函数名
voiddidPeerMessageReceived:fromUser:
  • HMRRoomObserver

Public 回调函数函数名
voiddidRoomMessageReceived:fromUser:inRoom:
voiddidRoomAttributesSet:withAttributes:byUser:
voiddidRoomAttributesAddedOrUpdated:withAttributes:byUser:
voiddidRoomAttributesDeleted:withAttributes:byUser:
voiddidRoomAttributesCleared:withAttributes:byUser:
  • HMRRoomMemberObserver

Public 回调函数函数名
voiddidRoomMemberJoined:inRoom:
voiddidRoomMemberLeft:inRoom:
voiddidRoomMemberOffline:
voiddidRoomMemberCountChanged:ofCount:
voiddidRoomMemberAttributesSet:inRoom:withAttributes:
voiddidRoomMemberAttributesAddedOrUpdated:inRoom:withAttributes:
voiddidRoomMemberAttributesDeleted:inRoom:withAttributes:
voiddidRoomMemberAttributesCleared:inRoom:withAttributes:

回调详细说明

HMREventObserver

HMREventObserver::didHummerStateChanged:toState:withReason:

- (void)didHummerStateChanged:(HMRState)oldState
                      toState:(HMRState)newState
                   withReason:(NSString *)reason;

Hummer SDK 状态变更回调

参数
参数描述
oldState变更前状态,详见 HMRState
newState当前状态
reason变更理由

HMREventObserver::didHummerKicked:withDescription:

- (void)didHummerKicked:(NSInteger)code
        withDescription:(NSString *)desc;desc;

SDK收到多端登录被踢的回调方法

参数
参数描述
code用户被踢下线的原因
desc用户被踢下线的具体描述

HMREventObserver::didHummerPreviousTokenExpired

- (void)didHummerPreviousTokenExpired;

token过期失效,SDK给予业务层的回调通知

注意:

  • 只有在 SDK 断线重连时token过期才会触发,收到该回调时,请调用 refreshToken 方法刷新Token

HMRPeerServiceObserver

HMRPeerServiceObserver::didPeerMessageReceived:fromUser:

- (void)didPeerMessageReceived:(HMRMessage *)message
                      fromUser:(HMRUserId *)user;

当收到点对点信令消息时,会收到该事件的通知回调

注意:

参数
参数描述
message收到的信令消息
user发送者标识

HMRRoomObserver

HMRRoomObserver::didRoomMessageReceived:fromUser:inRoom:

- (void)didRoomMessageReceived:(HMRMessage *)message
                      fromUser:(HMRUserId *)user
                        inRoom:(HMRRoomId *)roomId;

当有一个用户往房间内发一条信令消息时,房间内所有的成员都会收到该事件的通知回调

注意:

参数
参数描述
message收到的信令消息
user发送者标识
roomId房间标识

HMRRoomObserver::didRoomAttributesSet:withAttributes:byUser:

- (void)didRoomAttributesSet:(HMRRoomId *)roomId
              withAttributes:(NSDictionary<NSString *, NSString *> *)attributes
                      byUser:(HMRUserId *)user;

房间属性设置通知

注意:

参数
参数描述
roomId房间标识
attributes对应属性
user操作者标识

HMRRoomObserver::didRoomAttributesAddedOrUpdated:withAttributes:byUser:

- (void)didRoomAttributesAddedOrUpdated:(HMRRoomId *)roomId
                         withAttributes:(NSDictionary<NSString *, NSString *> *)attributes
                                 byUser:(HMRUserId *)user;

房间属性新增或更新通知

注意:

参数
参数描述
roomId房间标识
attributes对应属性
user操作者标识

HMRRoomObserver::didRoomAttributesDeleted:withAttributes:byUser:

- (void)didRoomAttributesDeleted:(HMRRoomId *)roomId
                  withAttributes:(nullable NSDictionary<NSString *, NSString *> *)attributes
                          byUser:(HMRUserId *)user;

房间属性删除通知

注意:

参数
参数描述
roomId房间标识
attributes对应属性
user操作者标识

HMRRoomObserver::didRoomAttributesCleared:withAttributes:byUser:

- (void)didRoomAttributesCleared:(HMRRoomId *)roomId
                  withAttributes:(nullable NSDictionary<NSString *, NSString *> *)attributes
                          byUser:(HMRUserId *)user;

房间属性清空通知

注意:

参数
参数描述
roomId房间标识
attributes对应属性
user操作者标识

HMRRoomMemberObserver

HMRRoomMemberObserver::didRoomMemberJoined:inRoom:

- (void)didRoomMemberJoined:(NSSet<HMRUserId *> *)members
                     inRoom:(HMRRoomId *)roomId;

成员进入房间通知

注意:

  • 该方法通过调用 joinRoom 发生回调。
  • 当房间人数超过500人时,将不会有该通知
参数
参数描述
menbers成员标识列表
roomId房间标识

HMRRoomMemberObserver::didRoomMemberLeft:inRoom:

- (void)didRoomMemberLeft:(NSSet<HMRUserId *> *)members
                   inRoom:(HMRRoomId *)roomId;

成员离开房间通知

注意:

  • 该方法通过调用 leaveRoom 发生回调。
  • 用户自己主动调用leaveRoom方法离开房间,不一定能收到该通知
  • 同房间内其他成员离开房间都能收到该通知
  • 当房间人数超过500人时,将不会有该通知
参数
参数描述
menbers成员标识列表
roomId房间标识

HMRRoomMemberObserver::didRoomMemberOffline:

- (void)didRoomMemberOffline:(NSSet<HMRRoomId *> *)roomIds;

当前用户断线超时离开房间通知

注意:

  • 只有当前用户因本地断线超时离开房间时才会触发该通知
参数
参数描述
roomIds房间标识列表

HMRRoomMemberObserver::didRoomMemberCountChanged:ofCount:

- (void)didRoomMemberCountChanged:(HMRRoomId *)roomId
                          ofCount:(NSInteger)count;

房间人数变更通知

注意:

  • 该方法通过调用 joinRoom 以及 leaveRoom发生回调
  • 断网、超时也会回调
参数
参数描述
roomId房间标识
count房间成员总数

HMRRoomMemberObserver::didRoomMemberAttributesSet:inRoom:withAttributes:

- (void)didRoomMemberAttributesSet:(HMRUserId *)member
                            inRoom:(HMRRoomId *)roomId
                    withAttributes:(NSDictionary<NSString *, NSString *> *)attributes;

房间成员属性设置回调通知

注意:

参数
参数描述
menber房间成员标识
roomId房间标识
attributes设置的属性

HMRRoomMemberObserver::didRoomMemberAttributesAddedOrUpdated:inRoom:withAttributes:

- (void)didRoomMemberAttributesAddedOrUpdated:(HMRUserId *)member
                                       inRoom:(HMRRoomId *)roomId
                               withAttributes:(NSDictionary<NSString *, NSString *> *)attributes;

房间成员属性新增或更新回调通知

注意:

参数
参数描述
menber房间成员标识
roomId房间标识
attributes设置的属性

HMRRoomMemberObserver::didRoomMemberAttributesDeleted:inRoom:withAttributes:

- (void)didRoomMemberAttributesDeleted:(HMRUserId *)member
                                inRoom:(HMRRoomId *)roomId
                        withAttributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;

房间成员属性删除回调通知

注意:

参数
参数描述
menber房间成员标识
roomId房间标识
attributes删除的属性

HMRRoomMemberObserver::didRoomMemberAttributesCleared:inRoom:withAttributes:

- (void)didRoomMemberAttributesCleared:(HMRUserId *)member
                                inRoom:(HMRRoomId *)roomId
                        withAttributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;

房间成员属性清空回调通知

注意:

参数
参数描述
menber房间成员标识
roomId房间标识
attributes清空的属性

文档是否有解决您的问题?

有帮助 没帮助
提交成功,非常感谢您的反馈!

反馈

TOP