connectrpc / examples-es

Examples for using Connect with various TypeScript web frameworks and tooling.
https://connectrpc.com/
Apache License 2.0
123 stars 23 forks source link

[Question] Why connect protocol can work with a private protocol without any additional work? #1443

Closed CaptainWang98 closed 9 months ago

CaptainWang98 commented 9 months ago

Hi there, I meet a interesting question. I usually work with browser and don't know much about RPC. So I come here for some help.

As the title says, I use connect-web in browser to replace axios simply. I used to use axios to send HTTP request to the server. The server support both simple HTTP request(for browser) and one kind of private protocol called xRPC(for other server) in same route. I want to figure out why the connect-web and the server can just works well. I guess there are two situation: the first is the connect protocol and xRPC protocol just happen to work well, and the second is they work by pure http, because the request header shows contentType: application/json.

Thank you for your time~

smaye81 commented 9 months ago

Hi @CaptainWang98. Without knowing a ton about your environment (or the xRPC protocol) it's hard to give a complete answer. It is theoretically possible that Connect would work here if you're using the JSON format since it would most likely be a simple POST over HTTP. Again, though, hard to say for sure. Can you elaborate a bit on your server environment? And re: xRPC, is this what you're referring to? https://atproto.com/specs/xrpc

CaptainWang98 commented 9 months ago

@smaye81 Thank you bro, I can't show more information about the protocol "xRPC"(It's not the real name), because it is not open-source now. But your advice is very helpful. Now, I'm trying to use wireshark to figure out what is going on. If I got any discover, I will share it there.