Is there a minimalist WebSocket client library for java?

The title says it all.

I'm trying to make a video game that connects to a server hosted on heroku for file verification.

Since heroku doesn't support vinella sockets I have to use websockets. I can make a websocket server just fine with Ruby or with some big java framework but I can't find a lightweight solution for making a client socket with java.

Thanks in advance!


Jetty has WebSocket Client API

Jetty WebSocket Client API

JSR 356 (Java API for WebSocket), part of Java EE 7 defines client API. There are multiple implementations: Tyrus (glassfish/WLS), Tomcat, ...; basically every container do provide the implementation or this api, even if not implementing other Java EE 7 specifications.

Simple example:

        final WebSocketContainer client = ContainerProvider.getWebSocketContainer();
        final Session session = client.connectToServer(new Endpoint() {
            public void onOpen(Session session, EndpointConfig EndpointConfig) {

                try {
                    session.addMessageHandler(new MessageHandler.Whole<String>() {
                        public void onMessage(String message) {
                            System.out.println("### Received: " + message);

                    session.getBasicRemote().sendText("Do or do not, there is no try.");
                } catch (IOException e) {
                    // do nothing

            public void onClose(Session session, CloseReason closeReason) {
                System.out.println("### Client session closed: " + closeReason);
        }, ClientEndpointConfig.Builder.create().build(), URI.create("ws://"));

You can check Client Endpoint chapter in Tyrus user guide for more details.

Need Your Help

signature constraint for generic types


struct S(int a, int b) { }

how to build multithreaded supported UI using C#(WPF)?

c# wpf user-interface

how to build multithreaded supported UI using C# ? At runtime I'm changing my values through UI and those values are getting passed to already running threads in backed code ? Please share if someo...