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

export functions in normalize.ts #1362

Closed

Conversation

wangcheng
Copy link

@wangcheng wangcheng commented Dec 3, 2024

Hi, team. I am developing a Connect client for Weixin Miniprogram. "Weixin Miniprogram" uses a special JS runtime that doesn't support fetch and and AbortSignal. So I have to port the logic to use its own fetching function.

Since I don't have AbortSignal I decided to drop signal support and not use functions in run-call. That means I need to use functions in normalize directly. Now I just copied the code to my repo like this.

I think it will be convenient to export them for third-party developers like me. Or do the team have a better suggestions for how to implement a client on runtimes that don't support fetch and AbortSignal?

@srikrsna-buf
Copy link
Member

fetch is not a hard requirement, you will have to implement UniversalClientFn and use that with the transports in @connectrpc/connect. In fact, node support is implemented in the same way, @connectrpc/connect-node is a good source for reference.

AbortSignal on the other hand is used throughout, the best way would be to polyfill AbortSignal and AbortController. Previous versions of connect ran tests against browsers without AbortSignal using a polyfill.

It is great to see connect being used in new runtimes! Let us know if you need anything.

@wangcheng
Copy link
Author

@srikrsna-buf Thank you for pointing out the UniversalClientFn. It is very useful!

@wangcheng wangcheng deleted the cheng-wang-export-normalize branch December 3, 2024 06:52
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

Successfully merging this pull request may close these issues.

2 participants