-
Notifications
You must be signed in to change notification settings - Fork 235
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
channel project #517
Comments
Well, I'll add the document of clients_pool/channel later. |
Wouldn't the concept of a channel be better suited to servers than clients? |
For example, if you have two http server in std::vector<std::string_view> hosts{"http://1.1.1.1","http://2.2.2.2"};
auto chan = coro_io::channel<coro_http_client>::create(hosts);
while (true) {
co_await chan.send_request(
[&](coro_http_client &client,
std::string_view host) -> Lazy<coro_http::resp_data> {
co_return co_await client.async_get("/");
});
} when you call |
Also, there is no library that manages sessions connected to the server, so how can I know the sessions connected to me? Does the library focus more on webserver than socket? |
You mean server(http or rpc)? the channel is only used in client, and it's transparent for server. |
This refers to the server in coro_rpc_server. For example, it refers to the socket of CPP. When a connection is made, a session will be maintained per client. Should I implement the sessions containing it separately? |
coro_rpc is a rpc framework, so it just care for each RPC call. User can't manage connection/session directly. But maybe I'll consider add some function to control connnection later(for example: close it acitively). |
Do you have any plans to add the tcp ip session library from yalantinglibs? |
I think you can just use |
thank you |
one of the purpose of rpc is hiding low level network, don't expose details to users, to make communication more easier cross processes. coro_rpc hope to provide a very easy way to develop a network application, the user only need to focus on their business logics, and get rid of so many details, such as async read/write, communication protocol, serialization, route, error handling etc. |
Still, when 100 users connect to the server, shouldn't they know the information about the session in this way so that user 1 wins and user 2 loses? |
the information should be maintained by business logic, similar with http session cookie. |
I have a question. From the answers above, I get the feeling that coro_rpc is stateless, so is what coro_rpc provides stateless? Is it stateful? If it's sateful, you should be able to manage the session yourself, but I'm really curious because the answer above says you can't do that. in coro_rpc example |
you are right, coro_rpc is stateless. |
We are currently investigating coro_rpc, and this is something that other team members are curious about and I am also curious about: https://alibaba.github.io/yalantinglibs/en/coro_rpc/coro_rpc_introduction.html#real-time-tasks-and-non-real- time-tasks Looking at the description of coro_rpc in the link, it appears that communication is maintained while being stateful when the connection is connected. However, when you said it was stateless, I was curious. Is there a way to write an explanation in the document or check it in the code? Instead of creating and maintaining the connection in the client.connect part, do you disconnect the connection immediately after the client.call? |
This document just say that you can response the rpc result directly by return statement, or use the handle to delay the response to avoid block the network io(for example, run a heavy work in other thread). It doesn't means that the rpc call is stateful. |
coro_rpc_client won't disconnect immmediately unless error happen or you close it manually. |
The simplest proof is to check whether the session ID changes after the connection is established. I have confirmed that conn_id exists in coro_rpc_server.hpp. Is it possible to print conn_id every time there is communication after connection? |
In debug mode server will print it |
When in debug mode, the server responds only when connecting for the first time, so I want to print out whether the connection ID changes after connecting what I want. I'm really curious. |
OK, I'll add it later. |
See #521 now you can get some context info by coro_rpc::context:
|
Hello, get_connect_id was confirmed as a unique id in coro_rpc_client, what I want to check is the conn_id in coro_rpc_server.hpp. According to the contributors, coro is stateless, but if the conn_id does not change in the client-server connection, it can be confirmed as stateful rather than stateless. Can I try modifying the conn_id? What part of coro_rpc_server.hpp can I call by entering connec_id? |
get_connect_id will return conn_id_ |
There is a channle in the project, but the channel uses client_pools.. Why? Is the concept of channels necessary for the client pool?? Is this just for testing purposes? Are there any channels needed on the server??
The text was updated successfully, but these errors were encountered: