Skip to content

Releases: hasura/go-graphql-client

v0.14.4

20 Jun 03:17
a6bedf2
Compare
Choose a tag to compare

What's Changed

  • Avoid NPE when populating headers with nil response by @kdudfield in #179

New Contributors

Full Changelog: v0.14.3...v0.14.4

v0.14.3

14 May 04:12
ac25fae
Compare
Choose a tag to compare

What's Changed

Optimize the WebSocketStats by limiting the max size of the closed connection IDs queue, default to 100. You can adjust the limit by setting SetMaxClosedConnectionMetricCacheSize.

Full Changelog: v0.14.2...v0.14.3

v0.14.2

13 May 17:46
33d5b8a
Compare
Choose a tag to compare

What's Changed

  • Improve subscription logging by replacing a metadata map with a source string, enabling richer logging details. Metadata now includes session_id and connection_id where applicable.
  • Introduced a WebSocketStats structure to track active and closed WebSocket connections, along with their unique IDs. Added methods to update and retrieve these statistics.

Full Changelog: v0.14.1...v0.14.2

v0.14.1

13 May 11:27
e19460f
Compare
Choose a tag to compare

What's Changed

  • feat: implement graceful shutdown for subscription client by @rbroggi in #171

New Contributors

Full Changelog: v0.14.0...v0.14.1

v0.14.0

26 Apr 10:45
4bb0498
Compare
Choose a tag to compare

Highlights

Subscription enhancements

  • The main runner will be a singleton. Get rid of the recursive loop to avoid goroutine leaks
  • Enhance the error handling. Add 2 new timeout settings, WithConnectionInitialisationTimeout and WithWebsocketConnectionIdleTimeout, to handle errors when the server is unresponsive. Check out the docs for more details.
  • Behavior changes: The state of subscription requests is retained until the Close method is called. Resubscribing to the subscription will initiate duplicate requests.

Support Retry for Query and Mutation

Introduced retry options for the GraphQL client, allowing customization for retries, backoff intervals, and error handling during GraphQL operations.

client := graphql.NewClient("/graphql", http.DefaultClient,
	// number of retries
	graphql.WithRetry(3),
	// base backoff interval. Optional, default 1 second.
	// Prioritize the Retry-After header if it exists in the response.
	graphql.WithRetryBaseDelay(time.Second),
	// exponential rate. Optional, default 2.0
	graphql.WithRetryExponentialRate(2),
	// retry on http statuses. Optional, default: 429, 502, 503, 504
	graphql.WithRetryHTTPStatus([]int{http.StatusServiceUnavailable}),
	// if the http status is 200 but the graphql response is error, 
	// use this option to check if the error is retryable.
	graphql.WithRetryOnGraphQLError(func(errs graphql.Errors) bool {
		return len(errs) == 1 && errs[0].Message == "Field 'user' is missing required arguments: login"
	}),
)

Get headers from response

Use the BindResponseHeaders option to bind headers from the response.

headers := http.Header{}
err := client.Query(context.TODO(), &q, map[string]any{}, graphql.BindResponseHeaders(&headers))
if err != nil {
  panic(err)
}

fmt.Println(headers.Get("content-type"))
// application/json

What's Changed

New Contributors

Full Changelog: v0.13.1...v0.14.0

v0.13.1

23 Sep 09:09
47ee315
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.13.0...v0.13.1

v0.13.0

29 Jul 15:51
1d68c4a
Compare
Choose a tag to compare

What's Changed

  • feat: returns NetworkError when the response returns a non-200 HTTP status code by @LukeSparkLayer in #143
  • feat: add ExecRawWithExtensions method for retrieving extensions in response by @r4fall1 in #144
  • feat: decode extensions from response via BindExtensions option by @hgiasac in #146

New Contributors

Full Changelog: v0.12.2...v0.13.0

v0.12.2

13 Jun 02:59
4f88d35
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.12.1...v0.12.2

v0.12.1

04 Mar 16:49
0fc7dc5
Compare
Choose a tag to compare

What's Changed

  • Expose GetSubscriptions method to get all active subscriptions by @hgiasac in #132

Full Changelog: v0.12.0...v0.12.1

v0.12.0

26 Feb 05:45
f578304
Compare
Choose a tag to compare

What's Changed

  • Add Unwrap() implementations for Error types by @calebbrown in #128
  • Restructure unit tests and add go.mod to examples to clean unused dependencies by @hgiasac in #129

New Contributors

Full Changelog: v0.11.0...v0.12.0