dgraphium icon indicating copy to clipboard operation
dgraphium copied to clipboard

Browser Support

Open snipebin opened this issue 4 years ago • 1 comments

Currently the DGraphium client implementation relies on the gRPC dgraph-js client which is not designed to be used in the browser.

DGraph publishes https://github.com/dgraph-io/dgraph-js-http for browser envs.

I see two possible approaches to implement:

  1. Add browser support to @dgraphium/client by implementing the same interface but using https://github.com/dgraph-io/dgraph-js-http instead, then generating a bundle with the implementation and making it available using the https://docs.npmjs.com/files/package.json#browser field, or

  2. Create a new package, i.e. @dgraphium/http-client

Thoughts?

snipebin avatar Oct 19 '20 18:10 snipebin

I believe implementation part can be easily generalized across http and gRPC client's. So I'd definitely like to avoid repetition on that part...

2nd solution is a bit easier and more flexible, however only downside is that logic will need to go in another package (maybe client-core) and then we'll use it in both clients.

Not sure about the 1st option.. I doubt it will properly work for both versions without tradeoffs.

binier avatar Oct 19 '20 19:10 binier