closeFor method

Future<void> closeFor(
  1. RpcChannelCloseReason reason
)

Closes the channel because the peer broke a rule, telling the peer why where the protocol underneath can say so.

The default closes the ordinary way. A channel whose protocol carries a reason -- WebSocket's close code -- or that must close in a particular way for the peer to read the answer already sent overrides it for the reasons it can serve and falls back to close for the rest.

A wrapper around another channel forwards this, or the reason is lost at the wrapper.

Implementation

Future<void> closeFor(RpcChannelCloseReason reason) => close();