{"id":13697585,"url":"https://github.com/b/kafka-websocket","last_synced_at":"2025-04-05T15:09:58.650Z","repository":{"id":14833395,"uuid":"17556225","full_name":"b/kafka-websocket","owner":"b","description":"Websocket server interface for Kafka distributed message broker","archived":false,"fork":false,"pushed_at":"2023-12-16T06:22:52.000Z","size":398,"stargazers_count":347,"open_issues_count":12,"forks_count":86,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-29T14:12:48.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-03-09T02:35:31.000Z","updated_at":"2025-03-04T00:35:34.000Z","dependencies_parsed_at":"2024-01-10T00:03:45.503Z","dependency_job_id":null,"html_url":"https://github.com/b/kafka-websocket","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b%2Fkafka-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b%2Fkafka-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b%2Fkafka-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b%2Fkafka-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b","download_url":"https://codeload.github.com/b/kafka-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353749,"owners_count":20925329,"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":[],"created_at":"2024-08-02T18:01:00.470Z","updated_at":"2025-04-05T15:09:58.628Z","avatar_url":"https://github.com/b.png","language":"Java","funding_links":[],"categories":["Libraries","网络编程"],"sub_categories":["Kafka"],"readme":"# kafka-websocket\n\nkafka-websocket is a simple websocket server interface to the kafka distributed message broker. It supports clients\nsubscribing to topics, including multiple topics at once, and sending messages to topics. Messages may be either text\nor binary, the format for each is described below.\n\nA client may produce and consume messages on the same connection.\n\n## Consuming from topics\n\nClients subscribe to topics by specifying them in a query parameter when connecting to kafka-websocket:\n\n/v2/broker/?topics=my_topic,my_other_topic\n\nIf no topics are given, the client will not receive messages. The format of messages sent to clients is determined by\nthe subprotocol negotiated: kafka-text or kafka-binary. If no subprotocol is specified, kafka-text is used.\n\nBy default, a new, unique group.id is generated per session. The group.id for a consumer can be controlled by passing a\ngroup.id as an additional query parameter: ?group.id=my_group_id\n\n## Producing to topics\n\nClients publish to topics by connecting to /v2/broker/ and sending either text or binary messages that include a topic\nand a message. Text messages may optionally include a key to influence the mapping of messages to partitions. A client\nneed not subscribe to a topic to publish to it.\n\n## Message transforms\n\nBy default, kafka-websocket will pass messages to and from kafka as is. If your application requires altering messages\nin transit, for example to add a timestamp field to the body, you can implement a custom transform class. Transforms\nextend us.b3k.kafka.ws.transforms.Transform and can override the initialize methods, or the transform methods for text\nand binary messages.\n\nTransforms can be applied to messages received from clients before they are sent to kafka (inputTransform) or to\nmessages received from kafka before they are sent to clients (outputTransform). See conf/server.properties for an\nexample of configuring the transform class.\n\n## Binary messages\n\nBinary messages are formatted as:\n\n[topic name length byte][topic name bytes (UTF-8)][message bytes]\n\n## Text messages\n\nText messages are JSON objects with two mandatory attributes: topic and message. They may also include an optional key\nattribute:\n\n{ \"topic\" : \"my_topic\", \"message\" : \"my amazing message\" }\n\n{ \"topic\" : \"my_topic\", \"key\" : \"my_key123\", \"message\" : \"my amazing message\" }\n\n## Configuration\n\nSee property files in conf/\n\n## TLS/SSL Transport\n\nkafka-websocket can be configured to support TLS transport between client and server (not from kafka-websocket to kafka). Client certificates\ncan also be used, if desired. Client auth can be set to none, optional, or required, each being, I hope, self-explanatory. See\nconf/server.properties for various configuration options.\n\n### Docker\n\nBuild a [Docker](https://www.docker.com/) image using the source code in the working directory:\n\n```\ndocker build -t kafka-websocket .\n```\n\nAfter the Docker image is finished building, run it with:\n\n```\ndocker run -it -p 7080:7080 kafka-websocket\n```\n\n## License\n\nkafka-websocket is copyright 2014 Benjamin Black, and distributed under the Apache License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb%2Fkafka-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb%2Fkafka-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb%2Fkafka-websocket/lists"}