Skip to content

Conversation

@ferranbt
Copy link
Contributor

@ferranbt ferranbt commented Jun 9, 2025

This PR adds a ping/pong system over the Rollup-boost <-> Builder connection. The context of this PR is in #304.

The inbound websocket service will send ping messages to the builder if after some time interval x has not received any message from the builder. After sending the ping message, it will wait another n time duration to receive the pong message back.

The test still needs more work.

@vercel
Copy link

vercel bot commented Jun 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rollup-boost ⬜️ Ignored (Inspect) Visit Preview Jun 12, 2025 8:09am

Copy link
Collaborator

@avalonche avalonche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if this can be handled with a library like fastwebsockets since this is quite a common web socket functionality?

@ferranbt
Copy link
Contributor Author

ferranbt commented Jun 9, 2025

I checked on tungstine and there was not an internal support to do ping, not sure if others have support for it.
Well, now that you mention it, this looks like a read timeout, maybe there is support for that.

@ferranbt
Copy link
Contributor Author

wondering if this can be handled with a library like fastwebsockets since this is quite a common web socket functionality?

Client side implementations do not have heartbeat implemented by default. In the server side it is enabled, if they get a Ping they reply with a Pong.

@ferranbt ferranbt marked this pull request as ready for review June 11, 2025 15:14
let (activity_tx, mut activity_rx) = mpsc::channel::<()>(10);

let timeout_task = tokio::spawn(async move {
let mut last_activity = Instant::now();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get more functions? I thinks this part could be spawn_activity_task, next could be spawn_ping_task, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean putting this logic in functions?

send_ping_tx.send(()).await.unwrap();
},
_ => {
println!("Received message: {:?}", msg);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this debugging message?

@ferranbt ferranbt merged commit 5917df8 into main Jun 12, 2025
7 checks passed
@ferranbt ferranbt deleted the ferrabt/ping-pong-ws branch June 12, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants