Exemplo n.º 1
0
        public JsonResult PostICE(string candidate, string label, string roomToken, string userToken)
        {
            var cand = new WebRTCCandidatesTable
            {
                Candidate   = candidate,
                Label       = label,
                RoomToken   = roomToken,
                Sender      = userToken,
                IsProcessed = false
            };

            _candidateRepository.Save(cand);

            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult GetICE()
        {
            string roomToken = Request["roomToken"];
            string userToken = Request["userToken"];

            WebRTCCandidatesTable cand = entities.WebRTCCandidatesTable.FirstOrDefault(t => t.RoomToken == roomToken && t.Sender != userToken && t.IsProcessed == false);

            if (cand == null)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }

            cand.IsProcessed = true;
            entities.Entry(cand).CurrentValues.SetValues(cand);
            entities.SaveChanges();

            return(Json(new { candidate = cand.Candidate, label = cand.Label }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult PostICE(string candidate, string label, string roomToken, string userToken)
        {
            WebRTCCandidatesTable cand = new WebRTCCandidatesTable()
            {
                ID          = Guid.NewGuid().ToString(),
                Candidate   = candidate,
                Label       = label,
                RoomToken   = roomToken,
                Sender      = userToken,
                IsProcessed = false,
                CreateOn    = DateTime.Now,
            };

            entities.WebRTCCandidatesTable.Add(cand);
            entities.SaveChanges();

            return(Json(true, JsonRequestBehavior.AllowGet));
        }