Skip to content

fix: ping/pong upstream server #355

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

Merged
merged 4 commits into from
Jul 31, 2025
Merged

Conversation

danyalprout
Copy link
Contributor

@danyalprout danyalprout commented Jun 26, 2025

Description

Add ping/pong for upstream connections (see #322). I'll add the equivalent for downstream clients in a separate PR

Copy link

vercel bot commented Jun 26, 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 Jul 30, 2025 8:38pm

@danyalprout danyalprout marked this pull request as ready for review June 26, 2025 21:37
@SozinM
Copy link
Collaborator

SozinM commented Jun 30, 2025

looks good IMO

@danyalprout danyalprout requested a review from SozinM June 30, 2025 18:47
@danyalprout
Copy link
Contributor Author

@SozinM can I get a review on this when you have time -- thanks

let mut interval = tokio::time::interval(options.ping_interval);
loop {
interval.tick().await;
if let Err(e) = write.send(Message::Ping(bytes::Bytes::new())).await {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be random bytes?

Copy link
Contributor

Choose a reason for hiding this comment

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

it doesn't really matter, it can be empty and won't matter. as long as a Ping is going, a Pong is expected. contents of ping is kind of useless imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it being empty should be ok. The mean reason to add data is to be able to track ping/pongs that are sent/arrive out of order.

Happy to add a couple of bytes of randomness if ya'll feel strongly about it

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay, should be good

@SozinM
Copy link
Collaborator

SozinM commented Jul 31, 2025

merging is as it's on;y websocket proxy changes

@SozinM SozinM merged commit da3c655 into flashbots:main Jul 31, 2025
8 checks passed
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