- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 640
Closed
Labels
⌛ reproduction neededIssue is subtle and requires a true accessible reproduction to debugIssue is subtle and requires a true accessible reproduction to debug⚡ websocketWeb Socket RelatedWeb Socket RelatedPriority: Waiting to be assignedTo be inside the next release process, it need to be marked with some level of priorityTo be inside the next release process, it need to be marked with some level of priorityneeds more infoMore information is requiredMore information is required
Milestone
Description
I face an issue that my request not reach to backend... Can you help in this?
also the same subscription work in Apollo graphql website.
 import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
class TrackingScreen extends StatefulWidget {
  const TrackingScreen({Key? key}) : super(key: key);
  @override
  State<StatefulWidget> createState() {
    return _TrackingScreenState();
  }
}
class _TrackingScreenState extends State<TrackingScreen> {
  @override
  Widget build(BuildContext context) {
    final httpLink = HttpLink(
      'https://......',
    );
    final authLink = AuthLink(
      getToken: () async => 'Bearer token',
    );
    var link = authLink.concat(httpLink);
    final websocketLink = WebSocketLink(
      'wss://......',
      config: const SocketClientConfig(
        inactivityTimeout: Duration(seconds: 30),
        delayBetweenReconnectionAttempts: Duration(seconds: 10),
      ),
    );
    link = Link.split(
      (request) => request.isSubscription,
      websocketLink,
      link,
    );
    final client = ValueNotifier<GraphQLClient>(
      GraphQLClient(
        cache: GraphQLCache(),
        link: link,
      ),
    );
    return GraphQLProvider(
      client: client,
      child: CacheProvider(
        child: Subscription(
          options: SubscriptionOptions(
            document: gql(
                r"""subscription Tracking($frequencyInSeconds: Int!, $packageNumber: Int!) {
                  tracking(frequencyInSeconds: $frequencyInSeconds, packageNumber: $packageNumber) {
     
                    timestamp
                  }
                }"""),
            variables: {
              "frequencyInSeconds": 3,
              "packageNumber": 10,
            },
            operationName: 'Tracking',
          ),
          builder: (result) => result.isLoading
              ? const Text('Loading...')
              : Text(result.data.toString()),
        ),
      ),
    );
  }
Metadata
Metadata
Assignees
Labels
⌛ reproduction neededIssue is subtle and requires a true accessible reproduction to debugIssue is subtle and requires a true accessible reproduction to debug⚡ websocketWeb Socket RelatedWeb Socket RelatedPriority: Waiting to be assignedTo be inside the next release process, it need to be marked with some level of priorityTo be inside the next release process, it need to be marked with some level of priorityneeds more infoMore information is requiredMore information is required