sendmessage/sendmessage_json
- 
简要描述 发送聊天消息 收到聊天消息的回调:on_roommessagereceived 
- 
函数原型 int sendmessage( struct roomclient client, tkstring message, const char toId = "__all") int sendmessage_json( struct roomclient client, tkstring message, tkstring extendJson, const char toId = "__all")` 
- 
返回值:return 0 success 
- 
参数 参数 类型 说明 toId const char* 接受者ID(要通知给哪些用户。“__all”:所有人;“__allExceptSender”:除自己以外的所有人;“__allExceptAuditor”:除旁听用户以外的所有人;“__None”:不通知任何人;某用户的peerID:只发给该用户) message tkstring 消息内容 extendJson tkstring 用户自定义扩展字段 
pubMsg
- 简要描述发布自定义信令 进入房间成功后,可以发送自定义的一些信令,用于用户之间相互通信。 发布自定义信令后,收到信令回调: on_roomremotepubmsg 
- 
函数原型 int pubMsg(struct roomclient client , const char msgName , const char msgId , const char acassociatedUserID , const char acassociatedMsgID , const char toId , bool save)` pubmsg_number();//发布data为number的信令 pubmsg_string();//发布data为字符串的信令 pubmsg_json();//发布data为json字符串的信令 
- 
返回值:返回值:请见错误码定义 
- 
参数 参数 说明 msgName 消息名字 msgId 消息id toId 要通知给哪些用户(“__all”:所有人;“__allExceptSender”:除自己以外的所有人;“__allExceptAuditor”:除旁听用户以外的所有人;“__None”:不通知任何人;某用户的peerID:只发给该用户) data 消息数据(可以是数字、字符串、Map或List) acassociatedUserID 表示该信令关联到用户ID。若被关联的用户离开教室后,此信令也会被删除。若需要关联,则传入用户ID,否则 nil acassociatedMsgID 表示该信令可以关联到另一个信令。若被关联的信令被删除后,此信令也会被删除。若需要关联,则传入另一信令ID,否则 nil save 是否保存 
delmsg
- 
简要描述 删除自定义信令 删除信令回调: on_roomremotedelmsg 
- 
函数原型 1 2 3 4 int delmsg(struct roomclient* client , const char* msgName , const char* msgId , const char* toId)
- 返回值:请见错误码定义
- 
参数: 参数 说明 msgName 消息名字 msgId 消息id toId 要通知给哪些用户;“__all”:所有人;“__allExceptSender”:除自己以外的所有人;“__allExceptAuditor”:除旁听用户以外的所有人;“__None”:不通知任何人;某用户的peerID:只发给该用户 data 消息数据,可以是数字、字符串、Map或List 
evictuser
- 
简要描述 将用户踢出房间 
- 
函数原型 int evictuser(struct roomclient* client,const char* peerID, int reason);
- 
返回值:return 0 success 
- 参数peerID:用户ID
- 参数reason:踢人原因,留给用户自定义(reason必须小于400)
switchonlyaudioroom
- 
简要描述 切换纯音频房间 可以自由将房间切换到纯音频或者正常的房间。 纯音频房间:即该房间所有用户都只会发布音频,没有视频。 切换成功后,回调: on_roomaudioroomswitch 
- 
函数原型 int switchonlyaudioroom(struct roomclient* client, bool onlyAudio)
- 
返回值:return 0 success 
- 参数onlyAudio:是否切换
selectserver
- 
简要描述 切换服务器 调用此接口,可以切换sdk链接的服务器。可以调用 getserverlist 接口获取到该房间可用的服务器列表。 
- 
函数原型 int selectserver(struct roomclient* client, const char* servername)
- 
返回值:return 0 success 
- 参数servername:服务器名称
changeuserproperty->number/string/json
- 
简要描述 修改用户的属性 可以调用此接口,修改指定用户的用户属性,比如奖杯数。 调用后,自己和其他用户均会收到修改成功的回调: onUserPropertyChanged(tk_uid peerId,const std::string& key,const tk::Variant& value) 
- 
接口详情 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int changeuserproperty_number(struct roomclient* client , const char* peerId , const char* tellWhom , const char* key , int value) int changeuserproperty_string(struct roomclient* client , const char* peerId , const char* tellWhom , const char* key , const char* value) int changeuserproperty_json(struct roomclient* client , const char* peerId , const char* tellWhom , const char* key , tkstring value)
- 
返回值:return 0 success 
- 
参数: 参数 说明 peerId 用户ID tellWhom 表示修改某一用户的属性成功后,需将此次属性变化的通知给房间其他用户对象。详情见 TKRoomDefines.h 相关定义. 可以是某一用户ID,表示此信令只发送给该用户 key 被修改的属性名称 value 被修改的属性名称对应的值 




 
                   
                  