Skip to content

Instantly share code, notes, and snippets.

@micimize
Last active August 27, 2021 15:06
Show Gist options
  • Save micimize/04ee011b445d38ce34193a5225992504 to your computer and use it in GitHub Desktop.
Save micimize/04ee011b445d38ce34193a5225992504 to your computer and use it in GitHub Desktop.
[OUTDATED] use SocketClientConfig.connect instead. old work around to headers for graphql flutter
@dunods
Copy link

dunods commented Aug 27, 2021

how do i apply this solustion to WSclient ?

final WSLink _webSocketLink = WSLink('ws://IP_ADDRESS/graphql',
config: SocketClientConfig(
autoReconnect: true,
inactivityTimeout: null,
),
headers: {"authorization": "exampletoken"});

final Link _link = _webSocketLink;
final GraphQLClient _client = GraphQLClient(
link: _link,
cache: GraphQLCache(),
);

i did try but still unable to connect
any idea @kateile?

please help

@micimize
Copy link
Author

@dunods Use SocketClientConfig.connect – this is outdated and probably won't work now

@dunods
Copy link

dunods commented Aug 27, 2021

@micimize .. im using the old version graphql_flutter: ^4.0.0 and still yet that code didnt work out.. any idea how to make it work

@micimize
Copy link
Author

probably some dev environment setup issue, but I really recommend upgrading at least to 4.1.0-beta.1.

I no longer contribute to graphql_flutter so I don't have the details fresh in my head anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment