connectFn property

WebSocketConnect? connectFn
final

Connect or reconnect to the websocket.

Useful supplying custom headers to an IO client, registering custom listeners, and extracting the socket for other non-graphql features.

Warning: if you want to listen to the stream, wrap your channel with our GraphQLWebSocketChannel using the .forGraphQL() helper:

connectFn: (url, protocols) {
   var channel = WebSocketChannel.connect(url, protocols: protocols)
   // without this line, our client won't be able to listen to stream events,
   // because you are already listening.
   channel = channel.forGraphQL();
   channel.stream.listen(myListener)
   return channel;
}

Implementation

final WebSocketConnect? connectFn;