closeAll method

Future<void> closeAll([
  1. int code = 1001,
  2. String reason = 'going away'
])

Closes every session with code (e.g. 1006-like drop, 1012 restart).

Implementation

Future<void> closeAll([int code = 1001, String reason = 'going away']) async {
  for (final s in List.of(_sessions)) {
    await s.close(code, reason);
  }
}