// GET: Distributer public ActionResult Index() { //ส่วนที่เชื่อมกับ JS โดยลิ้งด้วย tag string tag = this.Request.QueryString["tag"]; string x = DistributerController.getValueFromJson(tag); Response.ContentType = "text/event-stream"; Response.CacheControl = "no-cache"; Response.Expires = -1; Response.Flush(); Thread.Sleep(TimeSpan.FromSeconds(1)); return(Content("data: " + x + "\n\n")); }
/* * internal static void getAllMachineTagValue() * { * throw new NotImplementedException(); * } */ public static string getTagValue(string tagName) { string value = DistributerController.getValueFromJson(tagName); return(value); }