SignalR记录
服务端检索数据库,有跟新,推送给客户端
1: GlobalHost.ConnectionManager.GetHubContext<tvHub>().Clients.Client(Client.Key).sendMessage(UserHandler.dicGoods[roomid]);
winform或者其他 加载nuget包public class tvDataShow { private IHubProxy HubProxy { get; set; } private HubConnection Connection { get; set; } public void SendMessage(string roomId,List<tvModel> data) { HubProxy.Invoke("sendMessage", roomId, data); } public void controllerConnected(string roomId) { HubProxy.Invoke("controllerConnected", roomId); } /// <summary> /// Creates and connects the hub connection and hub proxy. This method /// is called asynchronously from SignInButton_Click. /// </summary> public async void ConnectAsync(string ServerURI) { Connection = new HubConnection(ServerURI); HubProxy = Connection.CreateHubProxy("tvHub"); try { await Connection.Start(); } catch (HttpRequestException) { return; } } }
慎于行,敏于思!GGGGGG