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

Consider connecting once and keeping the connection #5

Open
Kixunil opened this issue Sep 5, 2018 · 5 comments
Open

Consider connecting once and keeping the connection #5

Kixunil opened this issue Sep 5, 2018 · 5 comments
Labels
🪀 enhancement New feature or request

Comments

@Kixunil
Copy link
Contributor

Kixunil commented Sep 5, 2018

Instead of connecting to the socket for every request connect only when the socket is created and use the same connection for subsequent requests. Admittedly, I don't know if this is supported by C-lightning, but I'd be highly surprised if not.

If retrying is desired, it might be handled by the client. There are already crates helping with this.

This might be related to #4.

@laanwj
Copy link
Owner

laanwj commented Sep 5, 2018

The python binding also reconnects for every request, so I'm not sure that this is possible.

Also it would inherently serialize requests.

@Kixunil
Copy link
Contributor Author

Kixunil commented Sep 5, 2018

Would serializing requests be a problem?

@laanwj
Copy link
Owner

laanwj commented Sep 5, 2018

Maybe? It could be useful to be able to have multiple requests in progress at once, especially if there would be an async API. Some commands (waitinvoice etc) can wait pretty much forever.

@Kixunil
Copy link
Contributor Author

Kixunil commented Sep 5, 2018

That's a good point. It'd either had to be multiplexed somehow (if that's even possible) or handled from the outside. Alternatively, we could provide both APIs - the current one would be just a wrapper handling creating connection and calling appropriate request.

@laanwj
Copy link
Owner

laanwj commented Sep 5, 2018

A quick experiment (no error handling or reconnection whatsoever) shows that c-lightning can handle multiple successive requests over a connection, at least: https://github.com/laanwj/rust-clightning-rpc/tree/experiment

@laanwj laanwj added the 🪀 enhancement New feature or request label Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪀 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants