I've been working on writing a Web Socket server in Java and this point has confused me for a while now. On GitHub there's this library by TooTallNate that's a "barebones WebSocket client and server implementation in 100% Java": https://github.com/TooTallNate/Java-WebSocket
It has a ton of stars, and is actively developed.
But then it seems like Java already has websocket functionality in the main library? https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_a_WebSocket_server_in_Java
And there's also things like Jetty's WebSocket stuff: http://www.eclipse.org/jetty/documentation/9.4.x/jetty-websocket-server-api.html
There's also Netty which seems to have WebSocket stuff too.
So what exactly is the difference between these? Is it a question of simplicity? Or performance? Or are they totally separate things? If I need low-latency high-frequency sending of 5-10 kb messages, is there one option that would be most appropriate?
WebSocket is a technology providing for bi-directional, full-duplex communications channels, over a single Transmission Control Protocol (TCP) socket.
This is standardised by the IETF as RFC 6455.
The three links that you provided (TooTallNate, Mozilla, Jetty) are just the implementation of that websocket standards/protocol.
Similarly Netty also has Websocket implemenation.
Regarding which one to choose:
Look at it like, HTTP standard.
All Web servers (Tomcat, weblogic, Jetty, Apache HTTP etc) implement the same HTTP standard but which one to choose depends on many factors like:
So you may want to conduct some performance tests and see which one fits for your requirement.