subscribe method

Stream subscribe(
  1. String method, [
  2. List? params
])

Implementation

Stream<dynamic> subscribe(String method, [List<dynamic>? params]) {
  if (!isWebSocket) {
    throw StateError('subscribe requires a WebSocket URL');
  }
  final payload = jsonEncode({
    'jsonrpc': '2.0',
    'id': nextId,
    'method': method,
    'params': params ?? [],
  });
  // The subscription envelope is formatted; transport must be wired to
  // feed incoming notifications into the returned stream.
  throw UnimplementedError(
    'WebSocket transport not configured -- '
    'subscription payload ready: $payload',
  );
}