Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is ThriftClient usable in browser? #86

Closed
abelnation opened this issue Aug 3, 2018 · 2 comments
Closed

Is ThriftClient usable in browser? #86

abelnation opened this issue Aug 3, 2018 · 2 comments

Comments

@abelnation
Copy link

Trying to get it working with webpack, but it seems that it depends on too many node-specific deps. Have you guys had any luck (or even tried) making thrift calls from a browser?

@kevin-greene-ck
Copy link
Contributor

No, we haven't tested in the browser and I wouldn't expect it to work. The HTTP client you get from this library relies on a connection object built around the request library which uses Node's http module.

const connection = new HttpConnection(...)
const client = new ThriftClient(connection)

One could create there own connection object, extending ThriftConnection (https://github.com/creditkarma/thrift-server/blob/master/packages/thrift-server-core/src/main/types.ts#L34), built around something like fetch or XMLHttpRequest to get the client to work in the browser. Beyond that you would need a global polyfill for Node's Buffer object, which there are already a few options there.

I would like at some point to add browser support, but it's not our internal use case so it's hard to put priority on it.

@kevin-greene-ck
Copy link
Contributor

Closing in favor of #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants