Implement receive-message function.