Files
qhmes/yy-admin-master/YY.Admin.Services/Service/Jeecg/IJeecgBackendGateway.cs

46 lines
1.5 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.Net.Http;
namespace YY.Admin.Services.Service.Jeecg;
/// <summary>
/// Jeecg 后端访问网关:
/// 1. 统一封装 HTTP 调用;
/// 2. 统一封装 WebSocket 双向连接;
/// 3. 作为后续 Jeecg 集成功能的统一入口。
/// </summary>
public interface IJeecgBackendGateway
{
/// <summary>
/// 统一执行 Jeecg GET 请求(自动拼接 BaseUrl
/// </summary>
Task<HttpResponseMessage> ExecuteGetAsync(
string relativeOrAbsoluteUrl,
Dictionary<string, string>? headers = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 统一执行 Jeecg GET 请求并返回文本。
/// </summary>
Task<string?> ExecuteGetStringAsync(
string relativeOrAbsoluteUrl,
Dictionary<string, string>? headers = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 启动 Jeecg WebSocket 双向连接循环(自动重连)。
/// </summary>
Task RunWebSocketLoopAsync(
Func<string, Task> onMessage,
CancellationToken cancellationToken);
/// <summary>
/// 发送一条 WebSocket 消息(连接可用时)。
/// </summary>
Task<bool> SendWebSocketMessageAsync(string message, CancellationToken cancellationToken = default);
/// <summary>
/// 单次 WebSocket 上报(临时连接,适用于登录页等未常驻连接场景)。
/// </summary>
Task<bool> SendWebSocketOneShotAsync(string message, CancellationToken cancellationToken = default);
}