#bevy #websocket

bevy_websocket_adapter

Simple adapter to receive WebSocket messages in your bevy games as native Rust types

6 releases

0.1.5 Oct 10, 2021
0.1.4 Oct 10, 2021

#45 in WebSocket

Download history 25/week @ 2022-03-14 19/week @ 2022-03-21 6/week @ 2022-04-04 12/week @ 2022-04-25 48/week @ 2022-05-02 6/week @ 2022-05-09 102/week @ 2022-05-16 27/week @ 2022-05-23 48/week @ 2022-05-30 25/week @ 2022-06-06 2/week @ 2022-06-20

82 downloads per month

MIT/Apache

32KB
767 lines

Bevy websocket adapter

Simple adapter to receive WebSocket messages in your bevy games as native Rust types.

crates.io docs.rs license


🚧 This is a work in progress, many major features are not implemented

It uses tokio as the async backend and tungstenite for websocket protocol implementation.

You can check the examples directory for more details on the usage of this crate.


Table of content

Message format

All websocket messages must be JSON object in this format:

{
    "t": "MyMessageType",
    "d": "..."
}
⚠️ The t field MUST be unique across all your messages types, one value of t will always map to the same native rust type.

The contents of d can be any valid JSON value. Your native rust type must be able to serialize/deserialize the contents of d using the serde_json crate.

Roadmap

  • Receive message from clients
  • Deserialize messages to native Rust types
  • Connect / Disconnect EventReader
  • Send messages to clients
  • Broadcast message
  • Client
  • Raw message EventReader in Bevy
  • Unmatched messages EventReader

Dependencies

~7–20MB
~332K SLoC