off<T extends DataObject> method

void off<T extends DataObject>(
  1. MessageHandler<Message<T>> handler
)

Removes a handler for when a Message of type T is received from a connection.

Implementation

void off<T extends DataObject>(MessageHandler<Message<T>> handler) {
  for (final subscription
      in _subscriptions.whereType<StreamSubscription<Message<T>>>()) {
    if (subscription.onData == handler) {
      subscription.cancel();
      _subscriptions.remove(subscription);
      break;
    }
  }
}