onclose method

void onclose(
  1. ClosedCallback callback
)

Registers a handler that will be invoked when the connection is closed.

callback: The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).

Implementation

void onclose(ClosedCallback callback) {
  _closedCallbacks.add(callback);
}