Skip to content

Commit

Permalink
cleaned up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sterling Long committed Aug 11, 2023
1 parent fb2a199 commit 812adab
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions lib/apis/core/relay_client/relay_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> _onSubscribe(String topic) async {
Expand Down

0 comments on commit 812adab

Please sign in to comment.