added message handler on the client side