{"id":21940530,"url":"https://github.com/csutorasa/wiclax4j","last_synced_at":"2026-02-03T05:05:45.346Z","repository":{"id":38190665,"uuid":"323047929","full_name":"csutorasa/wiclax4j","owner":"csutorasa","description":"This is a pure java generic acquisition Wiclax server implementation","archived":false,"fork":false,"pushed_at":"2024-12-16T16:42:22.000Z","size":426,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T16:34:26.153Z","etag":null,"topics":["wiclax"],"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/csutorasa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2020-12-20T10:42:07.000Z","updated_at":"2024-09-27T22:21:44.000Z","dependencies_parsed_at":"2023-11-06T14:41:37.338Z","dependency_job_id":"3b9fe7b8-5cf5-4fc7-8ad6-adfe519ea563","html_url":"https://github.com/csutorasa/wiclax4j","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csutorasa%2Fwiclax4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csutorasa%2Fwiclax4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csutorasa%2Fwiclax4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csutorasa%2Fwiclax4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csutorasa","download_url":"https://codeload.github.com/csutorasa/wiclax4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250270263,"owners_count":21403014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["wiclax"],"created_at":"2024-11-29T02:33:31.337Z","updated_at":"2026-02-03T05:05:40.309Z","avatar_url":"https://github.com/csutorasa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wiclax4j ![Build wiclax4j](https://github.com/csutorasa/wiclax4j/workflows/Build%20wiclax4j/badge.svg) [![Maven Central](https://img.shields.io/maven-central/v/com.github.csutorasa.wiclax4j/wiclax4j.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.csutorasa.wiclax4j%22%20AND%20a:%22wiclax4j%22) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wiclax4j\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=wiclax4j)\n\nThis is a pure java implementation to create a generic acquisition [Wiclax](https://www.wiclax.com/) server. It has no\nruntime dependencies and is built with Java 8.\n\n## How to use\n\nCheck the latest version, and import the library as dependency\nfrom [here](https://search.maven.org/artifact/com.github.csutorasa.wiclax4j/wiclax4j).\n\n### Example\n\n```java\npackage org.example;\n\nimport com.github.csutorasa.wiclax.WiclaxClientConnection;\nimport com.github.csutorasa.wiclax.WiclaxServerSocketTest;\nimport com.github.csutorasa.wiclax.config.WiclaxProtocolOptions;\nimport com.github.csutorasa.wiclax.heartbeat.DefaultWiclaxHeartbeatWriterThread;\nimport com.github.csutorasa.wiclax.message.AcquisitionMessage;\nimport com.github.csutorasa.wiclax.model.Acquisition;\nimport com.github.csutorasa.wiclax.reader.DefaultWiclaxClientReaderThread;\n\nimport java.io.IOException;\nimport java.time.Instant;\n\npublic class WiclaxExample {\n    public static void main(String... args) throws IOException, InterruptedException {\n        // Create protocol options\n        WiclaxProtocolOptions options = WiclaxProtocolOptions.defaults();\n        // Create a server socket with port 12345\n        WiclaxServerSocket wiclaxServerSocket = new WiclaxServerSocket(12345, options);\n        // Accept a client connection\n        WiclaxClientConnection connection = wiclaxServerSocket.accept();\n        // Start reading requests from the client\n        connection.startReading(new DefaultWiclaxClientReaderThread(WiclaxExample::rewind));\n        // Start writing heartbeat messages\n        connection.startHeartbeatWriting(new DefaultWiclaxHeartbeatWriterThread());\n        // Send an acquisition\n        Acquisition acquisition = Acquisition.builder().deviceId(\"301\").chipId(\"123\").detectionTime(Instant.now()).build();\n        connection.send(new AcquisitionMessage(acquisition));\n        // Do some work\n        Thread.sleep(15000);\n        // Close connections, preferably in finally clause.\n        connection.close();\n        wiclaxServerSocket.close();\n    }\n\n    public static void rewind(Instant from, Instant to) {\n        // Handle rewind requests\n    }\n}\n```\n\n## How it works\n\nFirst it is recommended to get to know to the [protocol specification](docs/protocol.md)\nand [custom protocol options and configuration](docs/acquisitiontype.md).\n\n### Reader\n\nTo read from clients you can use any implementation\nof [WiclaxClientReader](src/main/java/com/github/csutorasa/wiclax/reader/WiclaxClientReader.java). There is a default\nimplementation [DefaultWiclaxClientReader](src/main/java/com/github/csutorasa/wiclax/reader/DefaultWiclaxClientReader.java)\nand a [DefaultWiclaxClientReaderThread](src/main/java/com/github/csutorasa/wiclax/reader/DefaultWiclaxClientReaderThread.java),\nbut you can customize it by handling the errors correctly. As there are no dependencies, there are no logging is\nincluded in the project.\n\n### Requests\n\nRequests need to be parsed first. [Request parsers](src/main/java/com/github/csutorasa/wiclax/requestparser)\nare extending\nthe [WiclaxRequestParser](src/main/java/com/github/csutorasa/wiclax/requestparser/WiclaxRequestParser.java).\n\nParsers create [requests](src/main/java/com/github/csutorasa/wiclax/request) that extend the\n[WiclaxRequest](src/main/java/com/github/csutorasa/wiclax/request/WiclaxRequest.java). These objects store the\ninformation about the request.\n\nAfter the request is parsed [request handlers](src/main/java/com/github/csutorasa/wiclax/request) must be added that\nextend [WiclaxRequestHandler](src/main/java/com/github/csutorasa/wiclax/requesthandler/WiclaxRequestHandler.java). They\nmust describe what requests they can support. It can return a response which will be sent to the client.\n\n### Responses\n\nAll [responses](src/main/java/com/github/csutorasa/wiclax/response) need to implement\nthe [WiclaxResponse](src/main/java/com/github/csutorasa/wiclax/response/WiclaxResponse.java). To create a new response\nyou need to override the `toData()` method and return the text to be sent to the client.\n\n### Messages\n\nAll [messages](src/main/java/com/github/csutorasa/wiclax/message) need to implement\nthe [WiclaxMessage](src/main/java/com/github/csutorasa/wiclax/message/WiclaxMessage.java). To create a new message you\nneed to override the `toData(WiclaxProtocolOptions)` method and return the text to be sent to the client.\n\n### Clock\n\nWiclax can synchronize the clock by sending a message to the server. The server must accept it as the current time, and\nshow all dates and times according to that time shift. By default, all connections have\nseparate [clocks](src/main/java/com/github/csutorasa/wiclax/clock/WiclaxClock.java).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsutorasa%2Fwiclax4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsutorasa%2Fwiclax4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsutorasa%2Fwiclax4j/lists"}