-
Notifications
You must be signed in to change notification settings - Fork 27
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
Http Upstream client #197
base: master
Are you sure you want to change the base?
Http Upstream client #197
Conversation
This pull request introduces the HTTP Upstream client. The main goal is to be backward compatible and introduce an HTTP upstream client. If the config has any HTTP/s server to connect to, the HttpClient struct will handle them. Any WebSocket will use the existing upstream client code. If one or more HTTP clients are configured, they route all requests, and Websocket clients will be used for subscriptions. If no HTTP clients are configured, the fallback behavior is used, and all requests and subscriptions are routed through the WebSocket upstream client. If no WebSocket upstream clients are configured, then subscriptions are not enabled, only method requests.
If you want to connect to http upstream then consider using a reverse proxy. Subway was built exactly to deal with websocket as there's no tool for it. Subway depends on websocket and that's the only thing it should deal with. This cannot be a tool for every problem. |
Hello @xlc, We plan to add an HTTP upstream client. Would contributing upstream be a good idea? The main goal is to route method calls to HTTP upstream clients and use the WebSocket upstream clients for subscriptions. The plan for this PR to be ready is as follows:
|
Introduce the meta Client that will instantiate the original Ws client or the new Http upstream client
I see some use cases this could be helpful. e.g. enable WS support for endpoint that only supports HTTP JSON RPC and the implementation shouldn't be too complicated (i.e. not much overhead to maintain it). So it should be a nice additional to have. |
The only way to achieve the so-called 'subscription' will be to repeatedly send requests to the HTTP server. I don't think it is efficient. |
Yeah I don't think there will be subscription support with HTTP upstream. It should only be enabled with WS upstream. |
For HTTP route calls it should be fine, but still there's the need to constantly call the HTTP repeatedly to get latest/finalized block but that is fine. |
This pull request introduces the HTTP Upstream client. The main goal is to be backward compatible and introduce an HTTP upstream client.
If the config has any HTTP/s server to connect to, the HttpClient struct will handle them. Any WebSocket will use the existing upstream client code.
If one or more HTTP clients are configured, they route all requests, and Websocket clients will be used for subscriptions.
If no HTTP clients are configured, the fallback behavior is used, and all requests and subscriptions are routed through the WebSocket upstream client.
If no WebSocket upstream clients are configured, then subscriptions are not enabled, only method requests.