dgraphium
dgraphium copied to clipboard
Browser Support
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:
-
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
-
Create a new package, i.e. @dgraphium/http-client
Thoughts?
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.