update api to runtime.onmessage