czyzby / gdx-lml

:octocat: LibGDX utility libraries.
Apache License 2.0
159 stars 25 forks source link

[WebSocket]TCP_NODELAY #68

Closed ange-black69 closed 6 years ago

ange-black69 commented 6 years ago

Hello, I don't find how to disable the nagle algorithm on my client ?

czyzby commented 6 years ago

Try setting up an issue in nv-websocker-client - gdx-websocket is a thin wrapper over this library and native browser web sockets. If you're using web sockets only on desktop/Android, you might want to use nv-websocket-client directly.

ange-black69 commented 6 years ago

Ok, thanks you for your quick answer. As I posted an question in stack overflow : [https://stackoverflow.com/questions/48167129/libgdx-correctly-using-websocket-for-gwt/48169838#48169838], it seems that the browser natively disable nagle algorithm on most browser, but i'm not quite sure about this..

czyzby commented 6 years ago

You might want to switch your server-side web sockets to something battle-tested and commonly used in enterprise web applications - these usually have better performance, less bugs and some actual commercial backing. I remember trying to use Java-WebSocket as well, and found out it had some issues - I believe the client is not fully compatible with the standard, since it had trouble connecting with my server. I've used Vert.x in several personal projects - as well as gdx-websocket examples - and never had any issues. We also used web sockets via Spring Boot at work. While Spring is definitely a higher level abstraction, Vert.x seems more flexible and performant.

czyzby commented 6 years ago

What I'm trying to say is - if plain old browser web sockets cannot connect with your server, it's probably a server issue. My GWT web socket implementation calls new WebSocket(url) and that's it - the rest of the initiation code is just binding various listeners to GWT callbacks. Try opening a dev console with F12 and connect with your server via "native" browser web sockets API. If you're experiencing the same issue, it's time to use a different server framework.

ange-black69 commented 6 years ago

Ok thanks you for your kind answer, I managed to get it work, So the client is running in a web browser ( GWT so ) and send message to the java-Websocket server without a issue. But i will consider Vert.x framework some days thank you for the info !