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

Option to set the tcp-nodelay flag used for the connection from the MQTT client to the broker #871

Closed
FedorSmirnov89 opened this issue May 24, 2024 · 0 comments

Comments

@FedorSmirnov89
Copy link
Contributor

FedorSmirnov89 commented May 24, 2024

Expected Behavior

It would be very useful to be able to specify whether the MQTT Client (in my case, I am using the AsyncClient) sets the nodelay flag when establishing the TCP connection to the broker.

Current Behavior

As far as I can tell, (a) there is no option to configure whether the client sets the nodelay flag and (b) the client uses tokio's TcpSocket, which by default does not set the nodelay flag, so that it is not possible for the user to implement a client which does not batch TCP packets when sending them to the broker.

Note

I would be happy to contribute to addressing this issue. I have submitted a PR (#872) with an extension of the NetworkOptions which would enable users to directly configure the nodelay, along with an example how this could be used.

FedorSmirnov89 added a commit to FedorSmirnov89/rumqtt that referenced this issue May 24, 2024
This extension allows users to specify whether the `nodelay` flag is set for the TCP connection from the MQTT client to the broker. This flag can help reduce latency by disabling Nagle's algorithm, which is beneficial in scenarios requiring minimal delay.

Signed off: FedorSmirnov89

Issue: bytebeamio#871
de-sh added a commit that referenced this issue May 28, 2024
* feat(mqtt-client): add option to set nodelay flag for TCP connection

This extension allows users to specify whether the `nodelay` flag is set for the TCP connection from the MQTT client to the broker. This flag can help reduce latency by disabling Nagle's algorithm, which is beneficial in scenarios requiring minimal delay.

Signed off: FedorSmirnov89

Issue: #871

* Apply suggestions from code review

Co-authored-by: Devdutt Shenoi <devdutt@outlook.in>

* Removed the nodelay example following review suggestion

---------

Co-authored-by: Devdutt Shenoi <devdutt@outlook.in>
@de-sh de-sh closed this as completed May 28, 2024
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

No branches or pull requests

2 participants