zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    面试相关
    luffy--01
    RESTful --01
    vue2 -- axios
    Vue --1
    crm--分页
    【SQL】UNION
    sql-新发现
    GROUPING
    记录的排列顺序——两个ORDER BY
  • 原文地址:https://www.cnblogs.com/GarsonZhang/p/5355436.html
Copyright © 2011-2022 走看看