https://github.com/robertbrewitz/bevy_native_websocket_example
https://github.com/robertbrewitz/bevy_native_websocket_example
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/robertbrewitz/bevy_native_websocket_example
- Owner: RobertBrewitz
- License: apache-2.0
- Created: 2024-10-28T20:47:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T21:15:49.000Z (about 1 year ago)
- Last Synced: 2024-10-28T21:37:24.612Z (about 1 year ago)
- Language: Rust
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Websockets in Bevy
Done in short notice to provide some examples of how to use websockets in Bevy.
This is an excerpt of a Native Websocket example that can be used to connect to any tls (wss) websocket endpoint.
## Key libraries
- [Mio](https://github.com/tokio-rs/mio) - cross-platform UDP/TCP non-blocking I/O
- [NativeTls](https://github.com/sfackler/rust-native-tls) - Platform specific TLS/SSL wrabstractions for Rust
- [Tungstenite](https://github.com/snapview/tungstenite-rs) - Barebones Websocket library for Rust
## Testing with AppSync
Create an AppSync endpoint and create a .env file based on the .env.example file and input the AppSync endpoint.
```bash
cargo run
```
Correctly configured AppSync API and auth method should connect to the endpoint and send an init message and get back a connection ack and keep alive messages.

## Authorization
I am using a custom lambda in my project, see [https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html](https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html) for more information.
## Licenses
Dual licensed under:
- MIT license ([MIT-LICENSE](./MIT-LICENSE) or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))
- Apache License, Version 2.0 ([APACHE-LICENSE](./APACHE-LICENSE) or [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0))