added a handler function for sending chat message