ConnectionStateType enum Null safety

网络连接状态。

Constants

Connected → const ConnectionStateType

网络已连接。该状态表示用户已经加入频道,可以在频道内发布或订阅媒体流。如果因网络断开或切换而导致 SDK 与频道的连接中断,SDK 会自动重连,此时 App 会收到:

@JsonValue(3)
const ConnectionStateType(2)
Connecting → const ConnectionStateType

建立网络连接中。

@JsonValue(2)
const ConnectionStateType(1)
Disconnected → const ConnectionStateType

网络连接断开。该状态表示 SDK 处于:

@JsonValue(1)
const ConnectionStateType(0)
Failed → const ConnectionStateType

网络连接失败。

该状态表示 SDK 已不再尝试重新加入频道,用户必须要调用 RtcEngine.leaveChannel 离开频道。

如果 SDK 因服务器端使用 RESTful API 禁止加入频道,则 App 会收到 RtcEngineEventHandler.connectionStateChanged 回调。

@JsonValue(5)
const ConnectionStateType(4)
Reconnecting → const ConnectionStateType

重新建立网络连接中。

该状态表示 SDK 之前曾加入过频道,但因网络等原因连接中断了,此时 SDK 会自动尝试重新接入频道。

  • 如果 SDK 无法在 10 秒内重新加入频道,则 RtcEngineEventHandler.connectionLost 会被触发,SDK 会一直保持在 Reconnecting 的状态,并不断尝试重新加入频道。
  • 如果 SDK 在断开连接后,20 分钟内还是没能重新加入频道,App 会收到 RtcEngineEventHandler.connectionStateChanged 回调,通知当前网络状态进入 Failed,SDK 停止尝试重连。
@JsonValue(4)
const ConnectionStateType(3)
values → const List<ConnectionStateType>

A constant List of the values in this enum, in order of their declaration.

const List<ConnectionStateType>

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
index int

The integer index of this enum.

final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
override

Operators

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