espressif / esp-protocols

Collection of ESP-IDF components related to networking protocols
195 stars 133 forks source link

[websocket] ability to set TCP_NODELAY (IDFGH-13509) #636

Open bryghtlabs-richard opened 2 months ago

bryghtlabs-richard commented 2 months ago

Is your feature request related to a problem?

Our customers play a turn-based game, sometimes their moves are delayed by ~40-200ms. Not every time, but often enough that it's a small burden in some of the quicker time formats.

Describe the solution you'd like.

I'd like the ability to dynamically configure TCP_NODELAY, or instead the ability to call setsockopt() myself at runtime. It should be runtime-configurable, as outside of games we send lots of websocket frame that can benefit from Nagling, but during quick games I need moves to go out on schedule.

Describe alternatives you've considered.

I've considered switching to UDP, but I'd have to implement reliability and connection myself, and websockets are a great fit for what we need here.

Additional context.

No response

bryghtlabs-richard commented 2 months ago

Looks like this may need to be wired into the transport layer(ssl vs tcp) too

euripedesrocha commented 2 months ago

Hi @bryghtlabs-richard thanks for the request. You are right, we need to set it in the transport level. We are already introducing the possibility to tcp_transport and will made it available on websocket after that.

The workaround to have it before we finish our process is to create a custom transport based on the ones available and use it on the websocket client.