Skip to content

tsrpc工程中没有指定传输协议POST/GET,源码中也没有传输协议,这是怎么实现的 #8

Answered by k8w
Jonnypeng asked this question in Q&A
Discussion options

You must be logged in to vote

因为 TSRPC 在一开始就设计为 传输协议无关的

所以你既可以在 HTTP 协议下使用,也可以在 WebSocket 下使用,也可以方便的扩展到原生 TCP、UDP 等协议。
试想一下,在 WebSocket 下自然是没有 POST/GET 的吧,所以对于传输协议无关的上层配置,自然不需要关注配置这些细节。

具体实现层面,HTTP Server 是统一使用 POST 的,当然如有需要,你可以通过 Flow 去扩展实现 GET 协议。

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by k8w
Comment options

You must be logged in to vote
2 replies
@k8w
Comment options

@k8w
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants