sendResponse static method

Future<void> sendResponse(
  1. P2PStream stream,
  2. OBPFrame response, {
  3. Duration timeout = defaultTimeout,
  4. String context = 'unknown',
})

Send a response frame

Used by servers to respond to client requests.

Implementation

static Future<void> sendResponse(
  core_p2p_stream.P2PStream stream,
  OBPFrame response, {
  Duration timeout = defaultTimeout,
  String context = 'unknown',
}) async {
  try {
    _logger.fine('[$context] Sending response: ${response.type}');
    await _writeFrame(stream, response, timeout: timeout, context: context);
    _logger.fine('[$context] Response sent successfully');
  } catch (e, stackTrace) {
    _logger.severe('[$context] Failed to send response: $e', e, stackTrace);
    rethrow;
  }
}