onMessage abstract method

StreamSubscription onMessage(
  1. dynamic callback(
    1. String message
    )
)

Registers callback as an event handler for the message event - which is triggered whenever a message is emitted through the socket.

To cancel the callback, you can call .cancel on the returned StreamSubscription.

Implementation

StreamSubscription onMessage(Function(String message) callback);