{"id":16078237,"url":"https://github.com/edouardpoitras/bevy_client_server_events","last_synced_at":"2025-11-05T04:02:28.292Z","repository":{"id":192120379,"uuid":"686115069","full_name":"edouardpoitras/bevy_client_server_events","owner":"edouardpoitras","description":"Simple event-based client-server networking library for Bevy","archived":false,"fork":false,"pushed_at":"2025-04-26T22:17:13.000Z","size":325,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-04T11:00:54.291Z","etag":null,"topics":["bevy","bevy-plugin","networking"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edouardpoitras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.md","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":"2023-09-01T19:29:55.000Z","updated_at":"2025-04-26T22:17:16.000Z","dependencies_parsed_at":"2024-08-24T05:29:50.467Z","dependency_job_id":"730ff942-ded7-4348-b6d7-499405742f0e","html_url":"https://github.com/edouardpoitras/bevy_client_server_events","commit_stats":null,"previous_names":["edouardpoitras/bevy_client_server_events"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/edouardpoitras/bevy_client_server_events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edouardpoitras%2Fbevy_client_server_events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edouardpoitras%2Fbevy_client_server_events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edouardpoitras%2Fbevy_client_server_events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edouardpoitras%2Fbevy_client_server_events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edouardpoitras","download_url":"https://codeload.github.com/edouardpoitras/bevy_client_server_events/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edouardpoitras%2Fbevy_client_server_events/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274152702,"owners_count":25231291,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bevy","bevy-plugin","networking"],"created_at":"2024-10-09T10:09:17.808Z","updated_at":"2025-11-05T04:02:28.174Z","avatar_url":"https://github.com/edouardpoitras.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ** DEPRECATED - no longer maintained **\n\nThis crate is now deprecated. Consider `bevy_replicon` or `lightyear`.\n\n# Bevy Client Server Events\n\n[![Bevy Client Server Events](https://github.com/edouardpoitras/bevy_client_server_events/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/edouardpoitras/bevy_client_server_events/actions/workflows/rust.yml)\n[![Latest version](https://img.shields.io/crates/v/bevy_client_server_events.svg)](https://crates.io/crates/bevy_client_server_events)\n[![Documentation](https://docs.rs/bevy_client_server_events/badge.svg)](https://docs.rs/bevy_client_server_events)\n![MIT](https://img.shields.io/badge/license-MIT-blue.svg)\n![Apache](https://img.shields.io/badge/license-Apache-blue.svg)\n\nSimple event-based client-server networking library for Bevy.\n\nEasily send bevy events to/from a client/server without worrying about serialization or network transport details.\n\nBuilds off of the renet/bevy_renet library and attempts to simplify the configuration and management of types to be sent through a network.\n\n**Goals**:\n- Simplified network setup and configuration\n- Easily send any types to/from a client/server\n\n**Requirements**:\n- `serde` to derive `Serialize` and `Deserialize` on your types\n\n## Events\n\nThe following events are useful for servers:\n- `EventWriter\u003cStartServer\u003e` - Send this event to start a server\n- `EventWriter\u003cStopServer\u003e` - Send this event to stop a running server\n- `EventReader\u003cClientConnected\u003e` - Received whenever a new client is connected\n- `EventReader\u003cClientDisconnected\u003e` - Received whenever a client has disconnected\n- `EventReader\u003cReceiveFromClient\u003cT\u003e\u003e` - Received whenever a client has sent type T to the server\n- `EventWriter\u003cSendToClient\u003cT\u003e\u003e` - Send this event to have a particular client receive type T\n- `EventWriter\u003cSendToClients\u003cT\u003e\u003e` - Send this event to have all connected clients receive type T\n\nThe following events are useful for clients:\n- `EventWriter\u003cConnectToServer\u003e` - Send this event to connect to a server\n- `EventWriter\u003cDisconnectFromServer\u003e` - Send this event to disconnect from the server\n- `EventWriter\u003cSendToServer\u003cT\u003e\u003e` - Send this event to have the server receive type T\n- `EventReader\u003cReceiveFromServer\u003cT\u003e\u003e` - Received whenever the server has sent type T to the client\n\nBoth the client and the server can receive the `EventReader\u003cNetcodeTransportError\u003e` events to deal with networking errors.\n\n## Examples\n\nThere are a few examples in the `examples/` directory.\n\n### Ping\n\nSee the `examples/ping.rs` file for a simple ping-pong example.\n\nIn one terminal session, start the server: `cargo run --example ping -- -s`\n\nIn another terminal session, connect with a client: `cargo run --example ping`\n\nWith the client window in focus, hit `ENTER` to send a Ping. The server will respond with a Pong.\n\nIn this example, we want to send a `Ping` event to the server and receive a `Pong` event in return.\n\n```rust,ignore\n#[derive(Event, Serialize, Deserialize)]\npub struct Ping;\n\n#[derive(Event, Serialize, Deserialize)]\npub struct Pong;\n```\n\nWhen setting up our `App`, we need to pass it to the `client_server_events_plugin` macro and provide all the types to be sent over the network.\n\n```rust,ignore\nfn main() {\n    // ...\n    let mut app = App::new();\n    client_server_events_plugin!(\n        app,\n        Ping =\u003e NetworkConfig::default(),\n        Pong =\u003e NetworkConfig::default()\n    );\n    // ...\n```\n\nYou can provide type-specific network configuration, such as reliability, resend time, max memory usage, etc.\n\nThe macro should be run regardless of whether this instance will be a server or a client.\n\nYou can choose to start a server instance or connect to a server as a client using events.\n\n```rust,ignore\nfn start_server(mut start_server: EventWriter\u003cStartServer\u003e) {\n    start_server.send(StartServer::default()); // Binds to 127.0.0.1:5000 with no encryption by default.\n}\n\nfn connect_as_client(mut connect_to_server: EventWriter\u003cConnectToServer\u003e) {\n    connect_to_server.send(ConnectToServer::default()); // Connects to 127.0.0.1:5000 with no encryption by default.\n}\n```\n\nThen you can send/receive events as desired.\n\n```rust,ignore\nfn update_client(\n    mut send_ping: EventWriter\u003cSendToServer\u003cPing\u003e\u003e,\n    mut receive_pong: EventReader\u003cReceiveFromServer\u003cPong\u003e\u003e,\n) {\n    // ...\n    send_ping.send(SendToServer { content: Ping });\n    // ...\n    for ReceiveFromServer { content } in receive_pong.read() {\n        // Do something with content (Pong).\n        // ...\n    }\n}\n\nfn update_server(\n    mut receive_ping: EventReader\u003cReceiveFromClient\u003cPing\u003e\u003e,\n    mut send_pong: EventWriter\u003cSendToClient\u003cPong\u003e\u003e,\n) {\n    for ReceiveFromClient { client_id, content } in receive_ping.read() {\n        // Do something with content (Ping).\n        send_pong.send(SendToClient {\n            client_id,\n            content: Pong,\n        });\n    }\n}\n```\n\n### Features Example\n\nSee the `examples/features.rs` file for examples of more features, such as encryption, broadcasting, networking error handling, and client connect/disconnect events.\n\nIn one terminal session, start the server: `cargo run --example features -- -s`\n\nIn another terminal session, connect with a client: `cargo run --example features`\n\nThe server and client will use encryption to communicate.\n\nEvery 500 frames the server will broadcast a message of it's frame count.\n\nWith focus on the server window:\n- Hit `ESC` to stop the server\n- Hit `ENTER` to start the server\n\nWith focus on the client window:\n- Hit `ESC` to disconnect from the server\n- Hit `ENTER` to reconnect to the server\n- Hit `SPACE` to send a message of type `PlayerMovement`\n\nThe server will respond to the `PlayerMovement` message with a `ServerResponse` message.\n\n## Other Networking Crates\n\nThis crate was created because I wanted the quickest and easiest way to send types through a network.\n\nOther solutions seem to have me bogged down in transport/networking/channel details.\n\nThis crate is ideal for prototyping and small client-server games.\n\nAn alternative with more bells \u0026 whistles would be [bevy_replicon](https://github.com/lifescapegame/bevy_replicon).\n\nA mature alternative with more customizability would be [bevy_renet](https://github.com/lucaspoffo/renet/tree/master/bevy_renet).\n\n## Bevy Compatibility\n\n|bevy|bevy_client_server_events|\n|---|---|\n|0.14|0.7|\n|0.12|0.6|\n|0.11|0.5|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedouardpoitras%2Fbevy_client_server_events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedouardpoitras%2Fbevy_client_server_events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedouardpoitras%2Fbevy_client_server_events/lists"}