/// <summary> /// 插入Session 对象 /// </summary> /// <param name="appSession"></param> public static void AddAppSession(WebSocketMsgModel appSession) { WebSocketSend <WebSocketMsgModel> .AddAppSession(appSession); }
public void Process(ISemanticProcessor proc, IMembrane membrane, WebSocketSend cmd) { EstablishConnection(); ws.Send(cmd.Data); }
/// <summary> /// 根据条件筛选 Session 对象 /// </summary> /// <param name="predicate"></param> /// <returns></returns> public static IEnumerable <WebSocketMsgModel> GetAppSessions(Func <WebSocketMsgModel, bool> predicate) { return(WebSocketSend <WebSocketMsgModel> .GetAppSessions(predicate)); }
/// <summary> /// 获取 所有 session 对象 /// </summary> /// <returns></returns> public static IEnumerable <WebSocketMsgModel> GetAllAppSessions() { return(WebSocketSend <WebSocketMsgModel> .GetAllAppSessions()); }
/// <summary> /// 所有连接用户发送消息 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Data"></param> public static async Task SendAllAsync <T>(T Data) { await WebSocketSend <WebSocketMsgModel> .SendAllAsync(Data); }
/// <summary> /// 发送消息 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="predicate"></param> /// <param name="Data"></param> public static async Task SendAsync <T>(Func <WebSocketMsgModel, bool> predicate, T Data) { await WebSocketSend <WebSocketMsgModel> .SendAsync(predicate, Data); }
/// <summary> /// 检查 session 是否存在 /// </summary> /// <returns></returns> public static bool Any(Func <WebSocketMsgModel, bool> predicate) { return(WebSocketSend <WebSocketMsgModel> .Any(predicate)); }
/// <summary> /// 获取 session 连接数 /// </summary> /// <returns></returns> public static int GetAppSessionCount() { return(WebSocketSend <WebSocketMsgModel> .GetAppSessionCount()); }
/// <summary> /// 移除Session 对象 /// </summary> /// <param name="predicate"></param> public static void RemoveSession(Func <WebSocketMsgModel, bool> predicate) { WebSocketSend <WebSocketMsgModel> .RemoveSession(predicate); }