Dgraph Client support for GraphQL backend

I tried to use the Js client but it seems there’s no support for the new GraphQL backend. Any update on when will the official dgraph clients be updated?

Currently, using apollo client is the alternative I see.

Yeah, been trying to do the same on Golang. The existing server side libraries for gql communication are outdated and have issues.

The client libraries are designed for GraphQL±, not for official GraphQL spec. There are plenty of libraries already in the GraphQL ecosystem, which we think can be used (or, just directly call via HTTP endpoint).

2 Likes

Using this on the JS side but for Golang you have any recommendations?

I’ve just been calling HTTP endpoint directly for Go, and using JSON.Unmarshal / Marshal etc. It’s pretty straightforward, not sure what a library would provide on top.

Yep, using the same currently. A wrapper on top would be great. We’ll spin up something :slight_smile: Thanks Manish!

1 Like

but how are you managing subscriptions here?

Is there any performance difference between grpc and http at Dgraph?

We didn’t find any good Go client libraries that support subscriptions so we wrote our own following the subscriptions-transport-ws/PROTOCOL.md at master · apollographql/subscriptions-transport-ws · GitHub protocol.

Here is the client code and some integration tests for your reference.
Apart from this any of the GraphQL client libraries should work with what we have here as Dgraph provides you a spec compliant GraphQL server.

Since both gRPC and HTTP API in Dgraph return JSON as a response there shouldn’t be a performance difference between the two.