{"id":15103685,"url":"https://github.com/alexsobiek/jws","last_synced_at":"2026-02-17T18:35:37.448Z","repository":{"id":205023058,"uuid":"711715322","full_name":"alexsobiek/jws","owner":"alexsobiek","description":"Java WebSocket Client Library","archived":false,"fork":false,"pushed_at":"2023-11-03T00:05:31.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T19:18:40.220Z","etag":null,"topics":["java","netty","websocket-client"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexsobiek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-30T02:53:30.000Z","updated_at":"2023-11-02T04:43:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"b132c8a0-25a4-4683-a3c7-b24c2695268b","html_url":"https://github.com/alexsobiek/jws","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.375,"last_synced_commit":"b27dcb6f51c9ef3d2559a1c468a0cb0e44d625a7"},"previous_names":["alexsobiek/jws"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexsobiek/jws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexsobiek%2Fjws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexsobiek%2Fjws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexsobiek%2Fjws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexsobiek%2Fjws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexsobiek","download_url":"https://codeload.github.com/alexsobiek/jws/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexsobiek%2Fjws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29552798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T18:16:07.221Z","status":"ssl_error","status_checked_at":"2026-02-17T18:16:04.782Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","netty","websocket-client"],"created_at":"2024-09-25T19:41:30.164Z","updated_at":"2026-02-17T18:35:32.424Z","avatar_url":"https://github.com/alexsobiek.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWS\nJWS is a very simple \u0026 modern Java websocket client using Netty. \n\n## Usage\nIn this example, we're going to connect to the Postman Echo Websocket service, send a message to it, and wait for the\nechoed message to be returned. This example makes use of the [Gson Codec](https://github.com/alexsobiek/jws/tree/main/codec/gson)\nto keep things simple.\n\n```java\nimport com.alexsobiek.jws.WebSocketClient;\nimport com.alexsobiek.jws.WebSocketClientHandler;\nimport com.alexsobiek.jws.gson.GsonWebSocketCodec;\nimport com.google.gson.JsonObject;\nimport io.netty.channel.ChannelHandlerContext;\n\nimport java.net.URI;\nimport java.util.concurrent.CompletableFuture;\n\nclass Example {\n    public static void main(String[] args) {\n        CompletableFuture\u003cJsonObject\u003e future = new CompletableFuture\u003c\u003e();\n        JsonObject message = new JsonObject();\n        message.addProperty(\"event\", \"ping\");\n\n        try (WebSocketClient\u003cJsonObject, JsonObject\u003e client = new WebSocketClient\u003c\u003e(new URI(\"wss://ws.postman-echo.com/raw\"), new GsonWebSocketCodec(), new WebSocketClientHandler\u003c\u003e() {\n            // Here we've created an inline WebSocketClientHandler instance, but you can create your own class that extends WebSocketClientHandler\n            // and override the onMessage and onException methods to handle messages and exceptions respectively. This is just a simple example.\n            public void onMessage(ChannelHandlerContext ctx, JsonObject message) { // Called when a message is received\n                future.complete(message); // Complete future with message\n            }\n\n            public void onException(ChannelHandlerContext ctx, Throwable exception) { // Called when an exception is thrown\n                future.completeExceptionally(exception); // Complete future with exception\n            }\n        })) {\n            try {\n                client.open().sync(); // Open and wait for connection\n                client.writeAndFlush(message); // Send message\n                System.out.printf(\"Sent message: %s\", message.toString());\n                while (!future.isDone()) Thread.onSpinWait(); // Keep connection open until message is received\n                client.close(); // Close connection\n            } catch (Exception e) {\n                throw new RuntimeException(e);\n            }\n\n            JsonObject response = future.get(); // Wait for message to be received\n            System.out.printf(\"Received message: %s\", response.toString());\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n```\n\n## Depending on JWS\nJWS can currently be found at [https://jitpack.io/#com.alexsobiek/JWS](https://jitpack.io/#com.alexsobiek/JWS).\nInstructions for your build tool can be found there.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexsobiek%2Fjws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexsobiek%2Fjws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexsobiek%2Fjws/lists"}