add MessageListener related function and test