add client side chat logic