call method

WebSocketChannel call({
  1. bool? blockAds,
  2. CDPLaunchOptionsOrString? launch,
  3. String? profile,
  4. num? timeout,
  5. String? token,
  6. String? trackingId,
  7. dynamic body,
})

Protocol: WebSocket Launch and connect to Chromium with a library like puppeteer or others that work over chrome-devtools-protocol.

Note: This endpoint is also available at: / for backwards compatibility. Summary: /chromium

Implementation

WebSocketChannel call({
  bool? blockAds,
  CDPLaunchOptionsOrString? launch,
  String? profile,
  num? timeout,
  String? token,
  String? trackingId,
  dynamic body,
}) {
  final queryParams = <String, String>{};
  if (defaultToken != null) {
    queryParams['token'] = defaultToken!;
  }
  if (blockAds != null) {
    queryParams['blockAds'] = blockAds.toString();
  }
  if (launch != null) {
    queryParams['launch'] = launch.toString();
  }
  if (profile != null) {
    queryParams['profile'] = profile.toString();
  }
  if (timeout != null) {
    queryParams['timeout'] = timeout.toString();
  }
  if (token != null) {
    queryParams['token'] = token.toString();
  }
  if (trackingId != null) {
    queryParams['trackingId'] = trackingId.toString();
  }
  final pathUrl = '/chromium';
  final uri = Uri.parse(
    '$baseUrl$pathUrl',
  ).replace(queryParameters: queryParams.isNotEmpty ? queryParams : null);
  final wsUri = uri.replace(scheme: uri.scheme == 'https' ? 'wss' : 'ws');
  return WebSocketChannel.connect(wsUri);
}