Added chat logic in the client