Make it possible to have stateful connections

Open
#60 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Frando is already working on this.

Since Oct 27, 2026.

  • #61 by @Frando — closed without merging
  • #155 by @Frando — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust

Research direction

Start with the auth.rs example and the RemoteConnection implementations for irpc over QUIC and irpc-iroh, then trace how irpc::Client handles reconnects. Define a connection-lifecycle mechanism for stateful setup, and verify that authentication is sent before application requests after every reconnect.

Written by the indexing model from the issue text.

Description

A typical usecase involves authenticating to a remote server.

I first thought this would be easy enough: See this example https://github.com/n0-computer/irpc/blob/main/irpc-iroh/examples/auth.rs

There's a Auth message that contains whatever authentication token you are using. The server expects the first message on a connection to be that message, and aborts the connection if not or if the token doesn't verify. From the server side, all is good.

On the client side however, it seems to be fine to just issue an Auth rpc call when constructing a client. However, it is not: the RemoteConnection impls for both irpc over quic and irpc-iroh support reconnects-on-demand: If the previous connection was aborted by the server in-between (e.g. because the server was restarted), irpc will reconnect to the server with the same args (alpn and node addr) than in the initial connection. The request submitted by the application will then be sent on the new connection - which will fail, because the server expects an Auth message as the first message on each connection.

It is currently completely invisible to the irpc::Client and application code if and when such reconnections happend, therefore there's no way currently to "send an Auth request first whenever a reconnect happens".

Fixing this is quite important to me, I have multiple uses of irpc that would need this. The only alternative currently is to send a token with each and every request, which is wasteful and cumbersome.

Dominant language
Rust
Stars
59
Forks
10
Avg merge
3d 15h
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from n0-computer/irpc

All issues in n0-computer/irpc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.