aliyun-rtc-sdk 6.13.6 → 6.14.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2170,7 +2170,7 @@ declare class BizControl extends default_2<BizControlListener> {
2170
2170
  * @ignore
2171
2171
  */
2172
2172
  static logName: string;
2173
- protected self: LocalUser | undefined;
2173
+ protected self: LocalUser;
2174
2174
  protected userMap: RemoteUserMap;
2175
2175
  private usersViewMap;
2176
2176
  rtsManager: RtsManager;
@@ -2192,12 +2192,11 @@ declare class BizControl extends default_2<BizControlListener> {
2192
2192
  private defaultStreamType;
2193
2193
  private audioMuted;
2194
2194
  private playoutVolume;
2195
+ private refreshUrlTimer?;
2195
2196
  private audioVolumeIndicationInterval;
2196
2197
  private indicationTimer;
2197
2198
  private parameter;
2198
2199
  constructor(config: BizControlConfig);
2199
- private publishRetryOptionsHook;
2200
- private subscribeRetryOptionsHook;
2201
2200
  private addSignalingManagerListener;
2202
2201
  isAutoSubAudio(): boolean;
2203
2202
  setAutoSubAudio(value: boolean): void;
@@ -2234,10 +2233,15 @@ declare class BizControl extends default_2<BizControlListener> {
2234
2233
  * @returns {void}
2235
2234
  */
2236
2235
  onRemotePublishStateChange(publishInfo: PublishUser): void;
2236
+ /** 定期更新所有人的推拉流地址,便于重连
2237
+ * @param pushStreamUrl 已有的推流地址,根据地址中的过期时间来设置定时器
2238
+ * @private
2239
+ */
2240
+ private setTimeoutToUpdateAllStreamUrls;
2237
2241
  /**
2238
2242
  * 登陆成功后初始化用户管理,创建自己
2239
2243
  * @param {AliRtcAuthInfo} authInfo
2240
- * @param {string} pushStreamUrl
2244
+ * @param {JoinResult} data
2241
2245
  * @returns {Promise<void>}
2242
2246
  */
2243
2247
  init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
@@ -2320,7 +2324,7 @@ declare class BizControl extends default_2<BizControlListener> {
2320
2324
  setAudioRedEnabled(enable: boolean): void;
2321
2325
  setParameter(parameter: string): void;
2322
2326
  getParameter(): string;
2323
- sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void> | undefined;
2327
+ sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void>;
2324
2328
  }
2325
2329
 
2326
2330
  declare interface BizControlConfig {
@@ -2386,6 +2390,15 @@ declare enum CodecType {
2386
2390
  UNKNOWN = ""
2387
2391
  }
2388
2392
 
2393
+ /**
2394
+ * websocket链接状态
2395
+ */
2396
+ declare enum CONNECTSTATUS {
2397
+ DISCONNECTED = 0,
2398
+ CONNECTING = 1,
2399
+ CONNECTED = 2
2400
+ }
2401
+
2389
2402
  declare interface DeviceStatus {
2390
2403
  micOpen: boolean;
2391
2404
  micInterrupted: boolean;
@@ -2411,17 +2424,41 @@ declare enum DisplayType {
2411
2424
  WHEN_NO_VIDEO = 2
2412
2425
  }
2413
2426
 
2414
- declare interface ISignalingInterface {
2415
- join(authInfo: AliRtcAuthInfo, userName: string, connectRetryCount?: number): Promise<JoinResult>;
2416
- leave(): Promise<SignalingResult>;
2417
- publish(publishInfo: PublishInfo): Promise<SignalingResult>;
2418
- roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
2419
- setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
2420
- refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
2421
- refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
2422
- reportStatus(status: string): Promise<void>;
2423
- on(event: string, listener: Function): void;
2424
- reset(): void;
2427
+ declare interface IResponse {
2428
+ version: number;
2429
+ code: number;
2430
+ msgtype: MessageType;
2431
+ tid: string;
2432
+ isproxy?: boolean;
2433
+ }
2434
+
2435
+ declare interface ISendPackage {
2436
+ version: number;
2437
+ msgtype: MessageType;
2438
+ tid: string;
2439
+ header: {
2440
+ appid: string;
2441
+ channelid: string;
2442
+ sessionid: string;
2443
+ userid: string;
2444
+ displayName?: string;
2445
+ clientversion?: string;
2446
+ platform?: string;
2447
+ };
2448
+ data: {
2449
+ seq: number;
2450
+ l1ip?: string;
2451
+ status?: string;
2452
+ clientrole?: string;
2453
+ configure?: {
2454
+ clientrole?: AliRtcSdkClientRole;
2455
+ channelprofile: AliRtcSdkChannelProfile;
2456
+ };
2457
+ auth?: SendPackageAuthInfo;
2458
+ sessionid?: string;
2459
+ pushstreamurl?: string;
2460
+ users?: any[];
2461
+ };
2425
2462
  }
2426
2463
 
2427
2464
  /**
@@ -2585,7 +2622,7 @@ declare class LocalUser extends User {
2585
2622
  * @ignore
2586
2623
  */
2587
2624
  static logName: string;
2588
- protected url: string;
2625
+ url: string;
2589
2626
  private joinTime;
2590
2627
  private _isPublishing;
2591
2628
  private publishPromise;
@@ -2726,6 +2763,7 @@ declare class LocalUser extends User {
2726
2763
  */
2727
2764
  publishUpdate(reason?: PublishReason): Promise<PublishInfo | undefined>;
2728
2765
  private syncPublishToRoomServer;
2766
+ updateStreamUrl(streamUrl?: string): void;
2729
2767
  private refreshPushStreamUrl;
2730
2768
  /**
2731
2769
  * 推流,用于 rts subscribe/publish 被调用后,此时 DataChannel 已存在
@@ -2856,6 +2894,23 @@ declare interface MediaTrackInfo {
2856
2894
  type?: CmdType;
2857
2895
  }
2858
2896
 
2897
+ declare enum MessageType {
2898
+ KEEPALIVE = "keepalive",
2899
+ JOINCHANNEL = "joinchannel",
2900
+ NOTIFYJOIN = "notifyjoin",
2901
+ NOTIFYSTATUS = "notifystatus",
2902
+ STATUSREPORT = "statusreport",
2903
+ LEAVECHANNEL = "leavechannel",
2904
+ NOTIFYLEAVE = "notifyleave",
2905
+ NOTIFYPUBLISH = "notifypublish",
2906
+ BYE = "bye",
2907
+ RECONNECT = "reconnect",
2908
+ PUBLISH = "publish",
2909
+ REFRESHURL = "refreshurl",
2910
+ UNSUBSCRIBE = "unsubscribe",
2911
+ ROLEUPDATE = "roleupdate"
2912
+ }
2913
+
2859
2914
  declare enum MPU_TASK_TRANSACTION_TYPE {
2860
2915
  MPU_TASK_TRANSACTION_START = 0,
2861
2916
  MPU_TASK_TRANSACTION_UPDATE = 1,
@@ -2892,6 +2947,53 @@ declare interface OSSToken {
2892
2947
  expiration: number;
2893
2948
  }
2894
2949
 
2950
+ declare class PackageCreater {
2951
+ protected authInfo: AliRtcAuthInfo;
2952
+ protected userName: string;
2953
+ protected seqIndex: number;
2954
+ constructor(authInfo: AliRtcAuthInfo, userName: string);
2955
+ get roleAuth(): SendPackageAuthInfo | undefined;
2956
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
2957
+ getSeqIndex(): number;
2958
+ /**
2959
+ * 创建一个心跳包
2960
+ * @returns
2961
+ */
2962
+ createKeepAlivePackage(): ISendPackage;
2963
+ /**
2964
+ * 创建一个用于发送入会消息的Package
2965
+ * @returns
2966
+ */
2967
+ createJoinPackage(): ISendPackage;
2968
+ /**
2969
+ * 创建一个用于发送离会消息的Package
2970
+ * @returns
2971
+ */
2972
+ crateLeavePackage(): ISendPackage;
2973
+ createStatusPackage(status: string): ISendPackage;
2974
+ /**
2975
+ * 创建一个用于发送推流消息的Package
2976
+ * @returns
2977
+ */
2978
+ createPublishPackage(): ISendPackage;
2979
+ createRoleUpdatePackage(): ISendPackage;
2980
+ createReconnectPackage(data?: ReconnectData): ISendPackage;
2981
+ createRefreshUrlPackage(): ISendPackage;
2982
+ /**
2983
+ * 创建一个Response包
2984
+ * @param {string} tid Notify消息的tid
2985
+ * @param {MessageType} msgType 消息类型
2986
+ * @returns {IResponse}
2987
+ */
2988
+ createResponsePackage(tid: string, msgType: MessageType): IResponse;
2989
+ /**
2990
+ *
2991
+ * @param messageType
2992
+ * @returns
2993
+ */
2994
+ protected createBaseSendPackage(messageType: MessageType): ISendPackage;
2995
+ }
2996
+
2895
2997
  declare type Parameter = {
2896
2998
  [key: string]: any;
2897
2999
  };
@@ -2988,6 +3090,14 @@ declare interface PublishUser {
2988
3090
  userid: string;
2989
3091
  }
2990
3092
 
3093
+ declare interface ReconnectData {
3094
+ role?: RoleForReconnectData;
3095
+ auth?: SendPackageAuthInfo;
3096
+ publish?: {
3097
+ users: [PublishInfo];
3098
+ };
3099
+ }
3100
+
2991
3101
  declare interface RefreshInfo {
2992
3102
  pushstreamurl?: string;
2993
3103
  users?: RefreshUser[];
@@ -3214,6 +3324,7 @@ declare class RemoteUser extends User {
3214
3324
  * @returns {void}
3215
3325
  */
3216
3326
  updateRemoteUserDeviceStatus(status: string): void;
3327
+ updateStreamUrl(streamUrl?: string): void;
3217
3328
  /**
3218
3329
  * 更新远端用户的推流状态,已经停止推流的 tracks 要 delete,或者整体 stop
3219
3330
  * @param {string} callid
@@ -3361,6 +3472,11 @@ declare interface RemoteUserViewMap {
3361
3472
  screenViews: HTMLVideoElement[];
3362
3473
  }
3363
3474
 
3475
+ declare interface RoleForReconnectData {
3476
+ channelprofile?: AliRtcSdkChannelProfile;
3477
+ clientrole?: AliRtcSdkClientRole;
3478
+ }
3479
+
3364
3480
  /**
3365
3481
  * RoomServerMessageCenter支持的事件
3366
3482
  */
@@ -3386,6 +3502,247 @@ declare interface RoomServerListener {
3386
3502
  onError: (err: AliRtcError) => void;
3387
3503
  }
3388
3504
 
3505
+ /**
3506
+ * RoomServer消息中心
3507
+ * 负责发送和接收信令数据,消息重发、回复Response
3508
+ */
3509
+ declare class RoomServerMessageCenter extends default_2<RoomServerListener> {
3510
+ static logName: string;
3511
+ protected authInfo: AliRtcAuthInfo;
3512
+ protected userName: string;
3513
+ protected channelProfile: AliRtcSdkChannelProfile;
3514
+ protected clientRole: AliRtcSdkClientRole;
3515
+ private slsReporter;
3516
+ protected wsClient: Socket;
3517
+ protected packageCreater: PackageCreater;
3518
+ protected keepAliveTimer: number;
3519
+ protected packageCache: Map<string, ISendPackage>;
3520
+ protected isFirstConnect: boolean;
3521
+ protected aliveChecker: number;
3522
+ protected reconnectData?: ReconnectData;
3523
+ constructor(authInfo: AliRtcAuthInfo, userName: string, channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, maxConnectRetryCount?: number);
3524
+ get retryCount(): number;
3525
+ /**
3526
+ * 开始连接信令
3527
+ * @param roomserverurl
3528
+ */
3529
+ start(roomserverurl: string): void;
3530
+ /**
3531
+ * 开始心跳计时器,并自动发送心跳包
3532
+ */
3533
+ startKeepAlive(): void;
3534
+ /**
3535
+ * 停止心跳计时器
3536
+ */
3537
+ stopKeepAlive(): void;
3538
+ /**
3539
+ * 发送入会、重连前所缓存信息
3540
+ */
3541
+ sendPkgCache(): void;
3542
+ /**
3543
+ * 发送离开房间
3544
+ */
3545
+ leave(): void;
3546
+ /**
3547
+ * 透明通道消息上报
3548
+ * @param status
3549
+ */
3550
+ reportStatus(status: string): void;
3551
+ /**
3552
+ * 发送推流消息
3553
+ */
3554
+ publish(_pubInfo: PublishInfo): void;
3555
+ /**
3556
+ * 更新角色
3557
+ */
3558
+ roleUpdate(role: string): void;
3559
+ /**
3560
+ * 更新推拉流地址
3561
+ * @param {RefreshInfo} info
3562
+ */
3563
+ refreshUrl(info: RefreshInfo): void;
3564
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
3565
+ /**
3566
+ * 关闭websocket连接,并销毁
3567
+ */
3568
+ close(): void;
3569
+ /**
3570
+ * 通过此方法发送数据到业务信令
3571
+ * 此方法会自动保存发送的package,并做重发.
3572
+ * response包不要通过此方法发送
3573
+ * @param pkg
3574
+ */
3575
+ protected sendPackage(pkg: ISendPackage): void;
3576
+ /**
3577
+ * 更新重连 payload
3578
+ * @param {ReconnectData} reconnectData
3579
+ */
3580
+ updateReconnectData(reconnectData?: ReconnectData): void;
3581
+ /**
3582
+ * 收到websocket连接成功的消息
3583
+ * ws连接建立成功后立刻发送join消息
3584
+ */
3585
+ protected onOpen(): void;
3586
+ /**
3587
+ * 收到业务信令消息
3588
+ * @param event
3589
+ */
3590
+ protected onMessage(event: MessageEvent): void;
3591
+ /**
3592
+ * 收到错误消息
3593
+ * @param event
3594
+ */
3595
+ protected onError(event: Event): void;
3596
+ /**
3597
+ * 连接失败
3598
+ */
3599
+ protected onConnectFail(): void;
3600
+ /**
3601
+ * 鉴权失败
3602
+ */
3603
+ protected onAuthInvalid(): void;
3604
+ /**
3605
+ * 网络异常
3606
+ */
3607
+ protected onNetworkError(): void;
3608
+ /**
3609
+ * 收到websocket断开消息
3610
+ * @param event
3611
+ */
3612
+ protected onClose(event: CloseEvent): void;
3613
+ protected onKeepAliveRsp(): void;
3614
+ protected onReconnectStart(): void;
3615
+ protected onReconnectFail(): void;
3616
+ /**
3617
+ * 处理 Keepalive 心跳,加速判断网络异常
3618
+ */
3619
+ protected checkAlive(): void;
3620
+ /**
3621
+ * 处理收到的业务信令
3622
+ * @param response
3623
+ */
3624
+ protected onRecvMessage(response: any): void;
3625
+ /**
3626
+ * 收到入会消息的response
3627
+ * @param response
3628
+ */
3629
+ protected onJoinResult(response: any): void;
3630
+ /**
3631
+ * 收到离开消息的response
3632
+ * @param response
3633
+ */
3634
+ protected onLeaveResult(response: any): void;
3635
+ /**
3636
+ * 收到publish消息的response
3637
+ * @param response
3638
+ */
3639
+ protected onPublishResult(response: any): void;
3640
+ /**
3641
+ * 收到roleUpdate消息的response
3642
+ * @param response
3643
+ */
3644
+ protected onRoleUpdateResult(response: any): void;
3645
+ /**
3646
+ * 收到 refreshurl 消息的response
3647
+ * @param response
3648
+ */
3649
+ protected onRefreshUrlResult(response: any): void;
3650
+ /**
3651
+ * 收到重联消息的response
3652
+ * @param response
3653
+ */
3654
+ protected onReconnectResult(response: any): void;
3655
+ /**
3656
+ * 收到业务信令下发的消息
3657
+ * @param response
3658
+ */
3659
+ protected onNotifyJoin(response: any): void;
3660
+ /**
3661
+ * 收到业务信令下发的透明通道消息
3662
+ * @param response
3663
+ */
3664
+ protected onNotifyStatus(response: any): void;
3665
+ /**
3666
+ * 收到远端用户离开的通知
3667
+ * @param response
3668
+ */
3669
+ protected onNotifyLeave(response: any): void;
3670
+ /**
3671
+ * 收到远端用户推流的通知
3672
+ * @param response
3673
+ */
3674
+ protected onNotifyPublish(response: any): void;
3675
+ /**
3676
+ * 收到statusreport的response
3677
+ * @param response
3678
+ */
3679
+ protected onStatusReport(response: any): void;
3680
+ /**
3681
+ * 收到被踢出频道的消息
3682
+ * @param {any} response
3683
+ */
3684
+ protected onBye(response: any): void;
3685
+ }
3686
+
3687
+ declare class RoomServerSignaling extends default_2<RoomServerListener> {
3688
+ /**
3689
+ * @ignore
3690
+ */
3691
+ static logName: string;
3692
+ protected messageCenter?: RoomServerMessageCenter;
3693
+ protected authInfo?: AliRtcAuthInfo;
3694
+ protected userName?: string;
3695
+ protected channelProfile: AliRtcSdkChannelProfile;
3696
+ protected clientRole: AliRtcSdkClientRole;
3697
+ private slsReporter;
3698
+ protected reconnectData?: ReconnectData;
3699
+ protected roomServerUri: string;
3700
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
3701
+ /**
3702
+ * 更新重连数据
3703
+ * @param {ReconnectData} reconnectData
3704
+ */
3705
+ private updateReconnectData;
3706
+ /**
3707
+ * 释放资源
3708
+ */
3709
+ reset(): void;
3710
+ /**
3711
+ * 加入频道
3712
+ * @param {AliRtcAuthInfo} authInfo
3713
+ * @returns
3714
+ */
3715
+ join(authInfo: AliRtcAuthInfo, userName: string, maxConnectRetryCount?: number): Promise<JoinResult>;
3716
+ /**
3717
+ * 离开频道
3718
+ * @returns
3719
+ */
3720
+ leave(): Promise<SignalingResult>;
3721
+ /**
3722
+ * 开始推流
3723
+ * @param pubInfo
3724
+ * @returns
3725
+ */
3726
+ publish(pubInfo: PublishInfo): Promise<SignalingResult>;
3727
+ roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
3728
+ setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
3729
+ /**
3730
+ * 更新推流地址
3731
+ */
3732
+ refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
3733
+ /**
3734
+ * 上报设备状态
3735
+ * @param status
3736
+ */
3737
+ reportStatus(status: string): Promise<void>;
3738
+ protected handleSignalError(code: number, description: string, errorCode?: AliRtcErrorCode): AliRtcError;
3739
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
3740
+ /**
3741
+ * 初始化MessageCenter,增加事件监听
3742
+ */
3743
+ protected initMessageCenter(): void;
3744
+ }
3745
+
3389
3746
  declare class RtsManager extends default_2<RtsManagerEventListener> {
3390
3747
  /**
3391
3748
  * @ignore
@@ -3402,16 +3759,19 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3402
3759
  private connected;
3403
3760
  private _pcTraceId;
3404
3761
  private _localJoinTime;
3405
- private publishRetryHook?;
3406
- private subscribeRetryOptionsHook?;
3407
3762
  private connectionResolve?;
3408
3763
  private connectingPromise?;
3409
3764
  private dcResolve?;
3410
3765
  private dcConnectingPromise?;
3411
3766
  private _publishingTracks;
3412
3767
  private parameter;
3413
- constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, publishRetryHook: () => void, subscribeRetryOptionsHook: () => RemoteSubscribeOptions | undefined, parameter: Parameter);
3768
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
3414
3769
  private addRTSListener;
3770
+ /**
3771
+ * 更新鉴权信息,传入一个新的带鉴权的 URL,RTS 会去除鉴权信息做更新
3772
+ * @param newUrlWithAuth
3773
+ */
3774
+ updateAuth(newUrlWithAuth: string): void;
3415
3775
  get pcTraceId(): string;
3416
3776
  set localJoinTime(time: number);
3417
3777
  setEncodedInsertableStreams(enable: boolean): void;
@@ -3443,7 +3803,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3443
3803
  private getSubConfig;
3444
3804
  private httpSubscribe;
3445
3805
  private subscribeAdd;
3446
- subscibeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<{
3806
+ subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<{
3447
3807
  url: string;
3448
3808
  stream: any;
3449
3809
  } | undefined>;
@@ -3475,12 +3835,19 @@ declare enum RtsPeerConnectionType {
3475
3835
  SUBSCRIBE = "subscribe"
3476
3836
  }
3477
3837
 
3838
+ declare interface SendPackageAuthInfo {
3839
+ timestamp: number;
3840
+ nonce?: string;
3841
+ token: string;
3842
+ tokenrole: AliRtcSdkTokenRole;
3843
+ }
3844
+
3478
3845
  declare class SignalingManager extends default_2<RoomServerListener> {
3479
3846
  /**
3480
3847
  * @ignore
3481
3848
  */
3482
3849
  static logName: string;
3483
- protected signaling?: ISignalingInterface;
3850
+ protected signaling?: RoomServerSignaling;
3484
3851
  protected authInfo?: AliRtcAuthInfo;
3485
3852
  protected userName?: string;
3486
3853
  protected channelProfile: AliRtcSdkChannelProfile;
@@ -3560,7 +3927,7 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3560
3927
  * 收到远端用户推流状态变化消息
3561
3928
  * @param {PublishInfo[]} users
3562
3929
  */
3563
- protected onNotifyPublish(users: PublishInfo[]): void;
3930
+ protected onNotifyPublish(users: PublishUser[]): void;
3564
3931
  /**
3565
3932
  * 收到被踢掉消息
3566
3933
  * @param {string} reason
@@ -3579,9 +3946,8 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3579
3946
  protected onNetworkError(err: AliRtcError): void;
3580
3947
  /**
3581
3948
  * 收到网络异常消息
3582
- * @param {AliRtcError} _err
3583
3949
  */
3584
- protected onAuthInvalid(_err: AliRtcError): void;
3950
+ protected onAuthInvalid(): void;
3585
3951
  protected onReconnectStart(): void;
3586
3952
  /**
3587
3953
  * 收到重连成功消息
@@ -3785,6 +4151,91 @@ declare interface SLSToken {
3785
4151
  expiration: number;
3786
4152
  }
3787
4153
 
4154
+ /**
4155
+ * Websocket类
4156
+ */
4157
+ declare class Socket extends default_2<SocketListener> {
4158
+ /**
4159
+ * @ignore
4160
+ */
4161
+ static logName: string;
4162
+ protected ws?: WebSocket;
4163
+ protected socketStatus: CONNECTSTATUS;
4164
+ protected wsUrl: string;
4165
+ protected lastConnectStartTime: number;
4166
+ protected maxConnectRetryCount: number;
4167
+ connectRetryCount: number;
4168
+ protected gotErr: boolean;
4169
+ protected closedByInvoke: boolean;
4170
+ protected isReconnecting: boolean;
4171
+ protected networkAvailableChecked: boolean;
4172
+ private reconnectTimeoutId;
4173
+ constructor(maxConnectRetryCount?: number);
4174
+ get connectUrl(): string;
4175
+ /**
4176
+ * 返回websocket连接的状态
4177
+ */
4178
+ get connectStatus(): CONNECTSTATUS;
4179
+ /**
4180
+ * 开始连接
4181
+ * @param wsUrl
4182
+ */
4183
+ start(wsUrl: string): void;
4184
+ /**
4185
+ * 发送消息
4186
+ * @param pkg
4187
+ */
4188
+ send(pkg: ISendPackage | IResponse): boolean;
4189
+ /**
4190
+ * 主动断开连接
4191
+ */
4192
+ close(): void;
4193
+ reconnect(): void;
4194
+ /**
4195
+ * 连接成功
4196
+ * @param event
4197
+ */
4198
+ protected onOpen(event: Event): void;
4199
+ /**
4200
+ * 收到消息
4201
+ * @param event
4202
+ */
4203
+ protected onMessage(event: MessageEvent): void;
4204
+ /**
4205
+ * 收到错误
4206
+ * @param event
4207
+ */
4208
+ protected onError(event: Event): void;
4209
+ /**
4210
+ * 连接断开
4211
+ * @param event
4212
+ */
4213
+ protected onClose(event: CloseEvent): Promise<void>;
4214
+ /**
4215
+ * 初始化websocket
4216
+ */
4217
+ protected initWebSocket(): void;
4218
+ /**
4219
+ * 反初始化websocket
4220
+ */
4221
+ protected uninitWebscoket(): void;
4222
+ }
4223
+
4224
+ /**
4225
+ * Socket的支持的事件
4226
+ */
4227
+ declare interface SocketListener {
4228
+ onOpen: (event: Event) => void;
4229
+ onMessage: (event: MessageEvent) => void;
4230
+ onError: (event: Event) => void;
4231
+ onClose: (event: CloseEvent) => void;
4232
+ onConnectFail: () => void;
4233
+ onAuthInvalid: () => void;
4234
+ onNetworkError: () => void;
4235
+ onReconnectStart: () => void;
4236
+ onReconnectFail: (event: Event) => void;
4237
+ }
4238
+
3788
4239
  declare interface StopPreviewConfig {
3789
4240
  videoElement?: HTMLVideoElement;
3790
4241
  primary?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliyun-rtc-sdk",
3
- "version": "6.13.6",
3
+ "version": "6.14.0-beta.0",
4
4
  "type": "module",
5
5
  "description": "rtc web sdk of aliyun",
6
6
  "main": "dist/aliyun-rtc-sdk.umd.js",
@@ -10,7 +10,7 @@
10
10
  "@aliyun-sls/web-sts-plugin": "^0.3.5",
11
11
  "@aliyun-sls/web-track-browser": "^0.3.5",
12
12
  "aliyun-queen-engine": "^6.3.3",
13
- "aliyun-rts-sdk": "2.9.3-beta.0",
13
+ "aliyun-rts-sdk": "^2.10.0",
14
14
  "crypto-js": "^4.1.1",
15
15
  "dateformat": "^5.0.3",
16
16
  "eventemitter3": "^5.0.1",