{"id":16225187,"url":"https://github.com/tomasfarias/dota-gsi","last_synced_at":"2026-01-06T02:11:39.460Z","repository":{"id":50661338,"uuid":"519023812","full_name":"tomasfarias/dota-gsi","owner":"tomasfarias","description":"A Rust library for Dota 2's Game State Integration.","archived":false,"fork":false,"pushed_at":"2025-02-24T12:32:19.000Z","size":160,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T04:37:17.607Z","etag":null,"topics":["dota2","tokio"],"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/tomasfarias.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,"zenodo":null}},"created_at":"2022-07-28T23:44:18.000Z","updated_at":"2025-03-29T17:43:55.000Z","dependencies_parsed_at":"2025-04-12T07:53:29.958Z","dependency_job_id":"1b351f17-0d56-4fe5-8703-6eb68b1566e1","html_url":"https://github.com/tomasfarias/dota-gsi","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/tomasfarias/dota-gsi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fdota-gsi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fdota-gsi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fdota-gsi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fdota-gsi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasfarias","download_url":"https://codeload.github.com/tomasfarias/dota-gsi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fdota-gsi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263066557,"owners_count":23408387,"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":["dota2","tokio"],"created_at":"2024-10-10T12:44:21.214Z","updated_at":"2026-01-06T02:11:39.455Z","avatar_url":"https://github.com/tomasfarias.png","language":"Rust","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# dota-gsi\n\n[![crates.io](https://img.shields.io/crates/v/dota-gsi.svg)](https://crates.io/crates/dota-gsi)\n[![CI/CD](https://github.com/tomasfarias/dota-gsi/actions/workflows/cd.yaml/badge.svg)](https://github.com/tomasfarias/dota-gsi/actions)\n\nGame State Integration with Dota 2 in Rust. Provides a server that listens for requests sent by Dota 2, processes them to extract their JSON payloads, and broadcasts the payloads to any user-configured handlers.\n\n# Requirements\n\nIntegration requires:\n1. Creating a `.cfg` [configuration file](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration) in the Dota 2 game configuration directory.\n2. Running Dota 2 with the -gamestateintegration [launch option](https://help.steampowered.com/en/faqs/view/7d01-d2dd-d75e-2955).\n\nThe configuration file can have any name name, but must be prefixed by `gamestate_integration_`.\nFor example, `gamestate_integration_test.cfg` would be located:\n* In Linux: `~/.steam/steam/steamapps/common/dota 2 beta/game/dota/cfg/gamestate_integration_test.cfg`\n* In Windows: `D:\\Steam\\steamapps\\common\\dota 2 beta\\dota\\cfg\\gamestate_integration_test.cfg`\n\nHere's a sample configuration file:\n\n```cfg\n\"dota2-gsi Configuration\"\n{\n   \"uri\"               \"http://127.0.0.1:53000/\"\n   \"timeout\"           \"5.0\"\n   \"buffer\"            \"0.1\"\n   \"throttle\"          \"0.1\"\n   \"heartbeat\"         \"30.0\"\n   \"data\"\n   {\n       \"buildings\"     \"1\"\n       \"provider\"      \"1\"\n       \"map\"           \"1\"\n       \"player\"        \"1\"\n       \"hero\"          \"1\"\n       \"abilities\"     \"1\"\n       \"items\"         \"1\"\n       \"draft\"         \"1\"\n       \"wearables\"     \"1\"\n   }\n   \"auth\"\n   {\n       \"token\"         \"abcdefghijklmopqrstuvxyz123456789\"\n   }\n}\n```\n\nNote the URI used in the configuration file must be the same URI used when initializing a `Server`.\n\n# Examples\n\n## Echoslam: echo game state integration\n\nThis program echoes game state integration events either in raw JSON or after deserialization into components provided by this library. The full program is available at [`src/bin/echoslam.rs`](./src/bin/echoslam.rs)\n\nThe program defines a handler to handle game state integration events by deserializing them to `T` (which is later defined to be `serde_json::Value` or `components::GameState`:\n\n```rust\nuse dota::{Server, components::GameState};\n\n/// Echo back game state integration events.\nasync fn echo_handler\u003cT\u003e(bytes: bytes::Bytes)\nwhere\n    T: DeserializeOwned + std::fmt::Display,\n{\n    let value: T = match serde_json::from_slice(\u0026bytes) {\n        Err(e) =\u003e {\n            log::error!(\"Failed to deserialize JSON body: {}\", e);\n            panic!(\"deserialize error\");\n        }\n        Ok(v) =\u003e v,\n    };\n\n    println!(\"{:#}\", value);\n}\n```\n\nA handler must implement the `Handler` trait, which is automatically implemented for async functions like this one, so it can be directly used in the next step.\n\nIn the `main` function, we run the `Server`. This includes first configuring the URI the `Server` will be listening on, and passing the handler function with `T` depending on inputs:\n\n```rust\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    env_logger::init();\n\n    let args = Args::parse();\n\n    let mut server = Server::new(\u0026args.uri);\n\n    if args.raw {\n        server = server.register(echo_handler::\u003cserde_json::Value\u003e);\n    } else {\n        server = server.register(echo_handler::\u003cGameState\u003e);\n    }\n\n    server.run().await?;\n    Ok(())\n}\n```\n\nFinally, the server runs forever.\n\nThis program is provided with `dota-gsi` and can be compiled with:\n\n```sh\ncargo build --release --bin echoslam\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasfarias%2Fdota-gsi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasfarias%2Fdota-gsi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasfarias%2Fdota-gsi/lists"}