ChatroomsService class

聊天室(《sdk-web/3.接口设计》第 13 节,《sdk-web/2.功能概述文档》第 14 节)。聊天室属于连接: Flutter 没有多个标签页,按本进程进入的聊天室维护(《2.功能概述文档》第 2 节),不按标签页计数; 重新连接(含网络切换,《2.功能概述文档》第 5.2 节)后立即重新进入,在服务端判定离开(15 秒)之前回到聊天室。

Inheritance

Constructors

ChatroomsService(Core core, JsonMap? _config(), JsonMap? _profile())

Properties

core → Core
final
entered → Map<String, ChatroomHandleImpl>
no setter
hashCode → int
The hash code for this object.
no setterinherited
log → ModuleLogger
final
me → String?
no setter
meOverride ↔ String? Function()?
测试用:替换本人的用户名。
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

config() → JsonMap?
create({required String name, String? description, String? avatarUrl, String? announcement, int? maxMembers, bool? listed}) → Future<JsonMap>
enter(String roomId, {String? ext, bool leaveOthers = false}) → Future<ChatroomHandleImpl>
多次进入返回同一个句柄,计数加一(《sdk-web/3.接口设计》第 13 节)。
forget(ChatroomHandleImpl handle) → void
句柄结束(离开或被移出)后从表中去掉。
get(String roomId) → Future<JsonMap>
join(String roomId, String? ext, bool leaveOthers) → Future<JsonMap>
chatroom.join:leaveOthers 时服务端离开这条连接上的其他聊天室(Flutter 中都属于本进程)。进入被限流时按等待时间重试。
leave(String roomId) → Future<void>
list({String? namePrefix, String? cursor, int? limit}) → Future<DRPage<JsonMap>>
markLeft(Iterable<String> roomIds) → void
进入的回复(成功或错误)中带 left_room_ids:这些聊天室已离开。
myProfile() → JsonMap?
本人资料(发送时填写本地消息的发送者昵称、头像)。
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onLeader() → void
本地数据加载完、开始连接之前(Web SDK 的“成为主标签页”)。
override
onlineCounts(List<String> roomIds) → Future<List<JsonMap>>
onReload() → Future<void>
从本地存储重新加载内存中的数据。
inherited
onSignedIn(bool fresh) → Future<void>
登录或恢复登录、数据库已打开:从本地存储加载需要的数据。
inherited
onSignedOut() → void
退出、会话结束、切换用户:清除内存中的数据、释放列表。
override
request(String op, JsonMap data) → Future<Object?>
只走长连接的请求(发送、设置和删除属性):未就绪时等待最长 15 秒。
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited