{"id":15942148,"url":"https://github.com/discretetom/ruast","last_synced_at":"2025-07-04T20:36:36.831Z","repository":{"id":114055508,"uuid":"409632449","full_name":"DiscreteTom/ruast","owner":"DiscreteTom","description":"Event driven async messaging framework.","archived":false,"fork":false,"pushed_at":"2021-11-16T10:16:31.000Z","size":395,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-05T06:38:57.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DiscreteTom.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-23T14:48:28.000Z","updated_at":"2023-08-27T04:19:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0840b4a-8f2f-4ecb-9462-21117ec3f5f1","html_url":"https://github.com/DiscreteTom/ruast","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2Fruast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2Fruast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2Fruast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiscreteTom%2Fruast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiscreteTom","download_url":"https://codeload.github.com/DiscreteTom/ruast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246274577,"owners_count":20751104,"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-10-07T07:40:27.819Z","updated_at":"2025-03-30T04:22:07.205Z","avatar_url":"https://github.com/DiscreteTom.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruast\n\n![GitHub](https://img.shields.io/github/license/DiscreteTom/ruast?style=flat-square)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/DiscreteTom/ruast?style=flat-square)\n\nEvent driven async messaging framework.\n\nThe rust version of [Rua](https://github.com/DiscreteTom/rua)!\n\n## Installation\n\n```toml\n[dependencies]\nrua = { git = \"https://github.com/DiscreteTom/ruast\" }\n```\n\n## Getting Started\n\nRun a websocket broadcast server:\n\n```toml\n# Cargo.toml\n[package]\nname = \"test\"\nversion = \"0.1.0\"\nedition = \"2018\"\n\n[dependencies]\ntokio = { version = \"1.12.0\", features = [\"full\"] }\nrua = { git = \"https://github.com/DiscreteTom/ruast\" }\nrua-tungstenite = { git = \"https://github.com/DiscreteTom/ruast\" }\nclonesure = \"0.3.0\"\n```\n\n```rust\n// main.rs\nuse clonesure::cc;\nuse rua::node::{broadcast::Broadcaster, Ctrlc, StdioNode};\nuse rua_tungstenite::listener::WsListener;\n\n/// Use `wscat -c ws://127.0.0.1:8080` to connect to the websocket server.\n#[tokio::main]\npub async fn main() {\n  // stoppable broadcaster\n  let mut bc = Broadcaster::default();\n\n  // websocket listener at 127.0.0.1:8080\n  let ws = WsListener::bind(\"127.0.0.1:8080\")\n    .on_new_peer(cc!(|@mut bc, ws_node| {\n      // new node will be added to the broadcaster\n      bc.add_target(\n        ws_node\n          .on_msg(cc!(|@bc, data| bc.write(data)))\n          .spawn()\n      );\n    }))\n    .spawn()\n    .await\n    .expect(\"WebSocket listener failed to bind address\");\n\n  // also print to stdout\n  bc.add_target(StdioNode::default().spawn());\n\n  println!(\"WebSocket listener is running at ws://127.0.0.1:8080\");\n\n  // wait for ctrlc, stop all targets\n  Ctrlc::default()\n    .on_signal(move || {\n      bc.stop_all();\n      ws.stop()\n    })\n    .wait()\n    .await\n    .expect(\"failed to listen for ctrlc\");\n}\n```\n\n## [More Examples](https://github.com/DiscreteTom/ruast/tree/main/rua/examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscretetom%2Fruast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscretetom%2Fruast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscretetom%2Fruast/lists"}