# Socket_Push_SDK **Repository Path**: fanfanv5/Socket_Push_SDK ## Basic Information - **Project Name**: Socket_Push_SDK - **Description**: 基于SignalR的二次封装开发包 - **Primary Language**: C# - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: https://www.nuget.org/packages/Socket_Push_SDK - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2019-04-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Signal R Push platform #### 介绍 基于SignalR的二次封装开发包 #### 软件架构 基于.net core 2.2 ,在SignalR的基础上进行了二次封装 #### 使用 引用dll或类库,在前端引入Socket_Push文件夹,相关js在Signal-R-Push-platform/Signal-R-Push-platform/wwwroot/Socket_Push ``` public class SocketPush_Action : ILinkAction { public LinkCheck GetLinkCheck() { return new LinkCheck((key, Context) => { return true; }); } public LinkOnConnected GetLinkOnConnected() { return new LinkOnConnected((key, Context,Client) => { }); } public LinkOnDisconnected GetLinkOnDisconnected() { return new LinkOnDisconnected((key, Context) => { }); } public ReciveFunc GetReciveFunc() { return new ReciveFunc((key, action, data) => { }); } } ``` ``` namespace Signal_R_Push_platform { public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSocket_Push(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseSocket_Push("/hub/c", "recive"); } } } ``` ``` ``` 服务端方法 ``` public static class Socket_Push { #region 发送信息 /// /// 直接发送信息 /// /// /// public static void Send(this IClientProxy Client, string Content) /// /// 发送使用传入key /// /// /// /// 发送成功数 public static int SendbyKey(string Key, string Content) /// /// 发送使用连接id /// /// /// /// public static int SendbyConnectionID(string ID, string Content) /// /// 向所有连接发送信息 /// /// /// public static int SendAll(string Content) #endregion #region 关闭连接 /// /// 使用连接id关闭连接 /// /// public static void ClosebyConnectionID(string ID) /// /// 使用传入key关闭连接 /// /// public static void ClosebyKey(string Key) /// /// 关闭所有连接 /// public static void CloseAll() #endregion #region 获取连接信息 /// /// 获取所有连接信息 /// /// public static List GetLinkInfo() /// /// 使用连接id获取连接信息 /// /// /// public static List GetLinkInfobyConnectionID(string ID) /// /// 使用key获取连接信息 /// /// /// public static List GetLinkInfobyKey(string Key) #endregion } ```