コード例 #1
0
ファイル: MyHub.cs プロジェクト: kimx/SignalRLab
 //Send=>Server Method
 public void Send(string name, string message)
 {
     Product p = new Product();
     p.Name = name;
     p.Category = message;
     Clients.All.sendMessage(p);//sendMessage==>Client Menthod
 }
コード例 #2
0
ファイル: ProductsController.cs プロジェクト: kimx/SignalRLab
 public ActionResult Index(string name)
 {
     IHubContext context = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
     Product p = new Product();
     p.Name = name;
     p.Category = DateTime.Now.ToString();
     context.Clients.All.sendMessage(p);
       //  h.Send(name, "Server Send:" + DateTime.Now.ToString());
     return View();//此範例需將WinForm執行起來
 }