{"id":13288439,"url":"https://github.com/weaming/hub","last_synced_at":"2025-05-05T11:30:58.793Z","repository":{"id":128810552,"uuid":"191688851","full_name":"weaming/hub","owner":"weaming","description":"Message hub. Export websocket and HTTP API.","archived":false,"fork":false,"pushed_at":"2023-03-07T02:25:25.000Z","size":5385,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T21:41:30.423Z","etag":null,"topics":["asyncapi","hub","message","message-driven","websocket"],"latest_commit_sha":null,"homepage":"https://hub.drink.cafe","language":"Go","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/weaming.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":"2019-06-13T04:07:13.000Z","updated_at":"2023-03-22T19:20:11.000Z","dependencies_parsed_at":"2023-04-17T11:00:52.525Z","dependency_job_id":null,"html_url":"https://github.com/weaming/hub","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/weaming%2Fhub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weaming%2Fhub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weaming%2Fhub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weaming%2Fhub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weaming","download_url":"https://codeload.github.com/weaming/hub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252488916,"owners_count":21756236,"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":["asyncapi","hub","message","message-driven","websocket"],"created_at":"2024-07-29T16:56:54.669Z","updated_at":"2025-05-05T11:30:55.475Z","avatar_url":"https://github.com/weaming.png","language":"Go","readme":"# Hub\n\n* The global `Hub` has many `Topic`s.\n* Every `Topic`has many subscribers and publisher, they are websocket connections.\n* One websocket connection will receive/publish messages from/to other subscribers.\n* `Hub` will publish `Message` to `Topic`.\n* `Topic` will send `Message` to all subscribers under it.\n    * One subscriber maybe receive same messge for more than one times.\n* Every subscriber will subscribe the \"global\" `Topic`.\n\n## Core structures\n\n```go\nconst GlobalTopicID = \"global\"\n\n// types of internal messages\nconst (\n\tMTPlain      string = \"PLAIN\"\n\tMTMarkdown   string = \"MARKDOWN\"\n\tMTMarkdownV2 string = \"MARKDOWNV2\"\n\tMTJSON       string = \"JSON\"\n\tMTHTML       string = \"HTML\"\n\tMTPhoto      string = \"PHOTO\"\n\tMTVideo      string = \"VIDEO\"\n)\n\n// types of websocket messages\nconst (\n\tMTFeedback string = \"FEEDBACK\" // used for async event feedback\n\tMTResponse string = \"RESPONSE\" // used for message response\n\tMTMessage  string = \"MESSAGE\"  // used for publish messages\n)\n\ntype RawMessage struct {\n\tType    string `json:\"type\"`    // required\n\tData    string `json:\"data\"`    // required, string or base64 of bytes\n\tCaption string `json:\"caption\"` // optional\n}\n\n// http client message\ntype PubMessage struct {\n\tType         string        `json:\"type\"`          // required\n\tData         string        `json:\"data\"`          // required, string or base64 of bytes\n\tCaption      string        `json:\"caption\"`       // required\n\tExtendedData []RawMessage  `json:\"extended_data\"` // optional, string or base64 of bytes, for sending multiple photos\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweaming%2Fhub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweaming%2Fhub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweaming%2Fhub/lists"}