WGShare.API/WGShare.Domain/DTOs/AgoraCallback/EventBody.cs

101 lines
4.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WGShare.Domain.Enums;
namespace WGShare.Domain.DTOs.AgoraCallback
{
public class EventBody
{
/// <summary>
/// 通知 ID标识来自声网业务服务器的一次事件通知。
/// </summary>
public string noticeId { get; set; }
/// <summary>
/// 业务 ID。值为 1 表示实时通信业务。
/// </summary>
public int productId { get; set; }
/// <summary>
/// 通知的事件类型。详见频道事件类型。
/// </summary>
public EventType eventType { get; set; }
/// <summary>
/// 声网消息服务器向你的服务器发送事件通知的 Unix 时间戳 (ms)。通知重试时该值会更新。
/// </summary>
public long notifyMs { get; set; }
/// <summary>
/// 会话 ID。
/// </summary>
public string sid { get; set; }
/// <summary>
/// 通知事件的具体内容。payload 因 eventType 而异,详见频道事件类型。
/// </summary>
public AgoraCallbackPayload payload { get; set; }
}
public class AgoraCallbackPayload
{
/// <summary>
/// 频道名称
/// </summary>
public string channelName { get; set; }
/// <summary>
/// 该事件在声网业务服务器上发生的 Unix 时间戳 (s)。
/// </summary>
public long ts { get; set; }
/// <summary>
/// 最后一个离开频道的用户 ID。(则声网消息通知可能返回不同的 lastUid此时任选其一即可。)
/// </summary>
public long lastUid { get; set; }
/// <summary>
/// 主播设备所属平台
/// </summary>
public PlatformType platform { get; set; }
/// <summary>
/// 序列号,标识该事件在 App 客户端上发生的顺序,可用于对同一用户的事件进行排序。详见维护用户在线状态。
/// </summary>
public long clientSeq { get; set; }
/// <summary>
/// String 类型的用户 ID。
/// </summary>
public string account { get; set; }
/// <summary>
/// 主播在频道内的时长 (s)。
/// </summary>
public int duration { get; set; }
/// <summary>
/// <para>主播离开频道的原因: </para>
/// <para>1主播正常离开频道。</para>
/// <para>2客户端与声网业务服务器连接超时。判断标准为声网 SD-RTN 超过 10 秒未收到该主播的任何数据包,或连接单台服务器 4 秒超时并在 1 秒内没有完成重连。</para>
/// <para>3权限问题。如被运营人员通过踢人 RESTful API 踢出频道。</para>
/// <para>4声网业务服务器内部原因。如声网业务服务器在调整负载和客户端短暂断开连接之后会重新连接。</para>
/// <para>5主播切换新设备迫使旧设备下线。</para>
/// <para>9由于客户端有多个 IP 地址SDK 主动与声网业务服务器断开连接并重连。此过程用户无感知。请检查用户是否存在多个公网 IP 或使用了 VPN。</para>
/// <para>10由于网络连接问题例如 SDK 超过 4 秒未收到来自声网业务服务器的任何数据包或 socket 连接错误SDK 主动与声网业务服务器断开连接并重连。此过程用户无感知。请检查网络连接状态。</para>
/// <para>999异常用户。例如用户短时间内频繁登录登出频道会被判定为异常用户。信息你的 App 服务端需要在收到 reason 为 999 的 104 事件 60 秒后调用踢人 API 将该用户踢出频道。否则,该用户再次加入频道后,可能无法收到相关事件通知。</para>
/// <para>0其他原因。</para>
/// </summary>
public LeaveReasonEnum reason { get; set; }
/// <summary>
/// 主播在频道内的用户 ID。
/// </summary>
public long uid { get; set; }
}
}