SSEManager class

SSE 连接管理器 用于管理多个 SSE 连接,支持同时维护多个连接

Constructors

SSEManager()

Properties

connectionCount int
获取连接数量
no setter
connectionIds List<String>
获取所有连接 ID
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addCancelFunction(String id, Future<void> cancel()) → void
添加取消函数(内部使用,子类可访问)
addConnection(String id, SSEConnection connection) → void
添加连接(内部使用,子类可访问)
connect({required String id, required String path, String method = 'GET', dynamic data, Map<String, String>? queryParameters, Map<String, String>? headers, String? baseUrl, String? service, required void onData(SSEEvent event), void onError(Object error)?, void onDone()?, bool replaceIfExists = true}) Future<String>
建立 SSE 连接并管理
disconnect(String id) Future<void>
断开指定连接
disconnectAll() Future<void>
断开所有连接
dispose() Future<void>
清理所有资源
ensureConnectionCompleter(String id) → void
确保连接的 Completer 存在(内部使用,子类可访问) 如果 Completer 不存在,创建一个新的
hasConnection(String id) bool
检查指定 ID 的连接是否存在
isConnected(String id) bool
检查指定 ID 的连接是否已连接
markConnectionDone(String id) → void
标记连接完成(内部使用,子类可访问)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeConnection(String id) → void
移除连接(内部使用,子类可访问)
toString() String
A string representation of this object.
inherited
waitForAllConnectionsDone() Future<void>
等待所有连接完成

Operators

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