Beispiel #1
0
        public Task Connect()
        {
            UserAccount ua = new UserAccount(Context.User.Identity.Name);

            ChatRoomUser cru = new ChatRoomUser();

            cru.GetChatRoomUserByUserAccountID(ua.UserAccountID);

            if (cru.ChatRoomUserID == 0)
            {
                cru.CreatedByUserID = ua.UserAccountID;
                cru.ConnectionCode = Context.ConnectionId;
                cru.Create();
            }
            else
            {
                cru.ConnectionCode = Context.ConnectionId;
                cru.UpdatedByUserID = ua.UserAccountID;
                cru.Update();
            }

            Send(@"<i style=""color:yellow;font-size:10px;font-style: italic;"">CONNECTION OPENED</i>", ua.UserAccountID);

            return Clients.joined(Context.ConnectionId, DateTime.UtcNow.ToString());
        }
Beispiel #2
0
        public Task Reconnect(IEnumerable<string> groups)
        {
            UserAccount ua = new UserAccount(Context.User.Identity.Name);

            ChatRoomUser cru = new ChatRoomUser();

            cru.GetChatRoomUserByUserAccountID(ua.UserAccountID);

            if (cru.ChatRoomUserID > 0)
            {
                cru.ConnectionCode = Context.ConnectionId;
                cru.UpdatedByUserID = ua.UserAccountID;
                cru.Update();
            }

            Send(@"<i style=""color:purple;font-size:10px;font-style: italic;"">RECONNECT</i>", ua.UserAccountID);

            return null;
        }