disconnect method

  1. @override
Future<void> disconnect ()
override

Shutdown the Server by Disconnecting from all sockets

Implementation

@override
Future<void> disconnect() async{
  stopDiscovery();
  await _serverSocket?.close();
  // disconnect with all the devices which we have open sockets with
  for( Device device in _discoveredDevices ) {
    await device._socket?.close();
    device._socket?.destroy();
  }
  _running = false;
  _discoveredDevices.clear(); // remove all devices found
}