added lock for getState to prevent multiple state creation for same chat room