disconnect method
Disconnects from the socket server.
Throws SocketDisconnectionException if disconnection fails.
Implementation
@override
Future<void> disconnect() async {
try {
await methodChannel.invokeMethod('disconnect');
} on PlatformException catch (e) {
_handlePlatformException(e, 'disconnect');
} catch (e) {
if (e is SocketException) {
rethrow;
}
throw SocketDisconnectionException('Unexpected error during disconnection: $e');
}
}