private ClientState GetClientState() { // New client state var jabbrState = GetCookieValue("jabbr.state"); ClientState clientState = null; if (String.IsNullOrEmpty(jabbrState)) { clientState = new ClientState(); } else { clientState = JsonConvert.DeserializeObject<ClientState>(jabbrState); } // Read the id from the caller if there's no cookie clientState.UserId = clientState.UserId ?? Caller.id; return clientState; }
private void OnUserInitialize(ClientState clientState, ChatUser user) { // Update the active room on the client (only if it's still a valid room) if (user.Rooms.Any(room => room.Name.Equals(clientState.ActiveRoom, StringComparison.OrdinalIgnoreCase))) { // Update the active room on the client (only if it's still a valid room) Caller.activeRoom = clientState.ActiveRoom; } LogOn(user, Context.ConnectionId); }
private ClientState GetClientState() { // New client state var jabbrState = GetCookieValue("jabbr.state"); ClientState clientState = null; if (String.IsNullOrEmpty(jabbrState)) { clientState = new ClientState(); } else { clientState = JsonConvert.DeserializeObject<ClientState>(jabbrState); } return clientState; }