fun onMessage(callback: MessageCallback): Ref
Register an on message callback. Multiple callbacks can be registerd.
Note: The callback might be called on another thread
callback
- A callback function
Return
A reference to the callback that can be used with the
Socket.off function.