generalized chat client. replaced old code