I use webSockets to connect the javascript webSocket client to java webSocketServer (from an Android application) using the Java-WebSocket library. An Android application sends a small message every few milliseconds to the javascript client.
Using a basic (and intuitive) approach for this situation, the delay between received messages, measured inside the javascript Client, shows (approximately) the following pattern: 200 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms , 0.1 ms, 0.1 ms, 200 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms, 200 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms, 0.1 ms ...
This is the default effect of the Nagle algorithm, discarding multiple messages before sending them.
Since I did not find a way to guarantee its deactivation, I follow the suggestion in
source share