-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add options to disable Nagle's algorithm (NoDelay) #327
Comments
Agree, such ability is highly appreciated for websocket application in real-time games. Any update on this? |
Agree. Maybe it would be better to have access to the TcpClient member so also other settings could be changed (eg. enable/disable KeepAlive) |
Hi, is there a reason #398 was never merged? Adding the option to have NoDelay would certainly be helpful in some use cases. |
hi, is there any progress? |
If someone needs help with that, I found a way around it using Reflection: var server = new WebSocketServer(address, port);
var listener = typeof(WebSocketServer).GetField("_listener").GetValue(_server) as TcpListener;
listener.Server.NoDelay = true; |
Thank you for providing the reflection workaround, that fixed my problem. On the client-side, a similar workaround should be done to disable the delay. I am using WebSocket-sharp both on the server and on the client. TCP client is accessible after the connection is opened. WebSocketServer using System.Reflection;
socketServer = new WebSocketServer(5555);
var listener = typeof(WebSocketServer).GetField("_listener", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(socketServer) as System.Net.Sockets.TcpListener;
listener.Server.NoDelay = true; WebSocketClient using System.Reflection;
ws = new WebSocket(uri);
ws.OnOpen += OnConnectionOpened;
...
private void OnConnectionOpened(object sender, System.EventArgs e)
{
var tcpClient = typeof(WebSocket).GetField("_tcpClient", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ws) as System.Net.Sockets.TcpClient;
tcpClient.NoDelay = true;
} |
Little enhancement: however sending realtime data over TCP is not best option, it would be nice to have such an option to have quicker responses in some cases. Am I right?
The text was updated successfully, but these errors were encountered: