public JsonResult MessageDelivered(int message_id) { Conversation convo = null; using (var db = new Models.ChatContext()) { convo = db.Conversations.FirstOrDefault(c => c.id == message_id); if (convo != null) { convo.status = Conversation.messageStatus.Delivered; db.Entry(convo).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } } string socket_id = Request.Form["socket_id"]; var conversationChannel = getConvoChannel(convo.sender_id, convo.receiver_id); pusher.TriggerAsync( conversationChannel, "message_delivered", convo, new TriggerOptions() { SocketId = socket_id }); return(Json(convo)); }
public JsonResult MessageDelivered(int message_id) { Conversation convo = null; using (var db = new Models.ChatContext()) { convo = db.Conversations.FirstOrDefault(c => c.id == message_id); if (convo != null) { convo.status = Conversation.messageStatus.Delivered; db.Entry(convo).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } } string socket_id = Request.Form["socket_id"]; var options = new PusherOptions(); options.Cluster = "PUSHER_APP_CLUSTER"; var pusher = new Pusher( "PUSHER_APP_ID", "PUSHER_APP_KEY", "PUSHER_APP_SECRET", options); pusher.TriggerAsync( "presence-chat", "message_delivered", convo, new TriggerOptions() { SocketId = socket_id }); return(Json(convo)); }