sendServerFeaturesCommand method

Future<void> sendServerFeaturesCommand()

Sends the server.features command to the proxy server.

This demos how to send the server.features command. Use as an example for sending other commands.

Returns: A Future that resolves to void.

Implementation

Future<void> sendServerFeaturesCommand() async {
  // The server.features command.
  const String command =
      '{"jsonrpc":"2.0","id":"0","method":"server.features","params":[]}';

  if (!sslEnabled) {
    // Send the command to the proxy server.
    _socksSocket.writeln(command);

    // Wait for the response from the proxy server.
    var responseData = await _responseController.stream.first;
    if (kDebugMode) {
      print("responseData: ${utf8.decode(responseData)}");
    }
  } else {
    // Send the command to the proxy server.
    _secureSocksSocket.writeln(command);

    // Wait for the response from the proxy server.
    var responseData = await _secureResponseController.stream.first;
    if (kDebugMode) {
      print("secure responseData: ${utf8.decode(responseData)}");
    }
  }

  return;
}