From 812adabfa301db63cbf3147482a7a4bf80ee86b7 Mon Sep 17 00:00:00 2001 From: Sterling Long Date: Thu, 10 Aug 2023 21:30:06 -0600 Subject: [PATCH] cleaned up the code --- lib/apis/core/relay_client/relay_client.dart | 40 +++++--------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/lib/apis/core/relay_client/relay_client.dart b/lib/apis/core/relay_client/relay_client.dart index 8c399c08..b3f47aca 100644 --- a/lib/apis/core/relay_client/relay_client.dart +++ b/lib/apis/core/relay_client/relay_client.dart @@ -385,47 +385,27 @@ class RelayClient implements IRelayClient { dynamic parameters, int? id, ]) async { - dynamic response; - // If we are connected and we know it send the message! if (isConnected) { - response = await jsonRPC!.sendRequest( - method, - parameters, - id, - ); + // Here so we dont return null } // If we are connecting, then wait for the connection to establish and then send the message else if (_connecting) { await _connectingFuture; - response = await jsonRPC!.sendRequest( - method, - parameters, - id, - ); } // If we aren't connected but should be (active), try to (re)connect and then send the message else if (!isConnected && _active) { await connect(); - response = await jsonRPC!.sendRequest( - method, - parameters, - id, - ); } - - // try {} on StateError catch (_) { - // // Reconnect to the websocket - // core.logger.v('StateError, reconnecting: $_'); - // await connect(); - // response = await jsonRPC!.sendRequest( - // method, - // parameters, - // id, - // ); - // } - - return response; + // In all other cases return null + else { + return null; + } + return await jsonRPC!.sendRequest( + method, + parameters, + id, + ); } Future _onSubscribe(String topic) async {