Example #1
0
        /// <summary>
        /// Broadcast message to all the active/online clients.
        /// </summary>
        /// <param name="username">Accept username of user who is sending the message</param>
        /// <param name="message">Accept message to be send</param>

        public void Send(string username, string message)
        {
            Clients.All.addNewMessageToPage(username, message);
            UserChat userchat = new UserChat
            {
                Message         = message,
                MessageFrom     = Guid.NewGuid(),
                MessageDateTime = DateTime.Now,
                User            = new User {
                    UserName = username
                }
            };
            var action = "home/SendMessage/";

            RestHelper.ExecutePostRequest <UserChatViewModel>(action, userchat);
        }