onmessage

external var onmessage: (response: T) -> Unit(source)

The handler called for every message sent by the Rust side of this channel.

Assigning a new handler replaces the previous one; messages that arrived before a handler was set are not replayed, so set it (or pass it to the constructor) before sending the channel to the backend.