/// <summary> /// 更新websocket /// </summary> /// <param name="customWebSocket"></param> public void UpdateCustomWebSocket(CustomWebSocket customWebSocket) { lock (_async) { _sockets.AddOrUpdate(customWebSocket.UUId, customWebSocket, (key, oldValue) => customWebSocket); } }
/// <summary> /// 添加连接 /// </summary> /// <param name="socket"></param> /// <param name="uuId"></param> /// <param name="userId"></param> /// <param name="port"></param> /// <param name="ip"></param> public bool AddSocket(WebSocket socket, string uuId, string userId, string ip = "") { lock (_addAsync) { var model = new CustomWebSocket { UUId = uuId, UserId = userId, WebSocket = socket, IP = ip, AddTime = DateTime.Now }; _sockets.AddOrUpdate(uuId, model, (key, oldValue) => model); return(true); } }
/// <summary> /// 更新websocket信息 /// </summary> /// <param name="customWebSocket"></param> public void UpdateCustomWebSocket(CustomWebSocket customWebSocket) { WebSocketConnectionManager.UpdateCustomWebSocket(customWebSocket); }