public void SignIn(SessionInfo session) { session.Callback = client; session.SessionId = OperationContext.Current.SessionId; Console.WriteLine("{0} User {1} signs in", DateTime.Now.Millisecond, session.UserName); Sessions.AddOrUpdate(session.SessionId, session, (key, value) => session); string res = null; if (syncHistory.TryPeek(out res)) // get the latest object and then push it to client client.Push(res); }
public void SignOut() { SessionInfo info = new SessionInfo(); if (Sessions.TryRemove(OperationContext.Current.SessionId, out info)) Console.WriteLine("{0} User {1} signs out", DateTime.Now.Millisecond, info.UserName); }